@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.js CHANGED
@@ -105,6 +105,8 @@ function fromWire(body) {
105
105
  case "provider-already-registered":
106
106
  case "proposal-invalid-state-transition":
107
107
  case "approval-not-decided":
108
+ case "slug-conflict":
109
+ case "project-default-already-exists":
108
110
  return { code: "conflict", message, reason: code };
109
111
  case "invalid-request":
110
112
  case "validation-failed":
@@ -459,6 +461,16 @@ function makeAgentsClient(transport) {
459
461
  idempotencyKey: options.idempotencyKey
460
462
  }
461
463
  });
464
+ },
465
+ async derive(agentId, input, options) {
466
+ return transport.request({
467
+ method: "POST",
468
+ path: `/v1/agents/${seg(agentId)}/versions`,
469
+ body: input,
470
+ ...options?.idempotencyKey !== void 0 && {
471
+ idempotencyKey: options.idempotencyKey
472
+ }
473
+ });
462
474
  }
463
475
  },
464
476
  async reinstateVersion(agentId, version, options) {
@@ -478,6 +490,20 @@ function makeAgentsClient(transport) {
478
490
  };
479
491
  }
480
492
 
493
+ // src/scope-wire.ts
494
+ function scopeForBody(scope) {
495
+ if (scope.kind === "tenant") return { kind: "tenant" };
496
+ if (scope.kind === "org") return { kind: "org", orgId: scope.orgId };
497
+ return { kind: "project", projectId: scope.projectId };
498
+ }
499
+ function scopeToQuery(scope) {
500
+ if (scope.kind === "tenant") return { scopeKind: "tenant" };
501
+ if (scope.kind === "org") {
502
+ return { scopeKind: "org", scopeId: scope.orgId };
503
+ }
504
+ return { scopeKind: "project", scopeId: scope.projectId };
505
+ }
506
+
481
507
  // src/status-query.ts
482
508
  function singleStatusQuery(method, status) {
483
509
  if (status === void 0) return void 0;
@@ -504,6 +530,7 @@ function makeApprovalsClient(transport) {
504
530
  ...filter?.limit !== void 0 && { limit: filter.limit },
505
531
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
506
532
  ...statusParam !== void 0 && { status: statusParam },
533
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
507
534
  ...filter?.requiredRole !== void 0 && { requiredRole: filter.requiredRole },
508
535
  ...filter?.createdAfter !== void 0 && {
509
536
  createdAfter: filter.createdAfter
@@ -809,6 +836,72 @@ function makeAuthClient(transport) {
809
836
  };
810
837
  }
811
838
 
839
+ // src/resources/blocks.ts
840
+ function makeBlocksClient(transport) {
841
+ const seg = (s) => encodeURIComponent(s);
842
+ return {
843
+ async publish(input, options) {
844
+ return transport.request({
845
+ method: "POST",
846
+ path: "/v1/blocks",
847
+ body: { ...input, projectId: options.projectId },
848
+ ...options.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
849
+ });
850
+ },
851
+ async list(filter) {
852
+ return transport.request({
853
+ method: "GET",
854
+ path: "/v1/blocks",
855
+ query: {
856
+ ...filter?.limit !== void 0 && { limit: filter.limit },
857
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
858
+ ...filter?.kind !== void 0 && { kind: filter.kind },
859
+ ...filter?.name !== void 0 && { name: filter.name },
860
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope)
861
+ }
862
+ });
863
+ },
864
+ async get(blockId) {
865
+ return transport.request({ method: "GET", path: `/v1/blocks/${seg(blockId)}` });
866
+ },
867
+ versions: {
868
+ async list(blockId, filter) {
869
+ return transport.request({
870
+ method: "GET",
871
+ path: `/v1/blocks/${seg(blockId)}/versions`,
872
+ query: {
873
+ ...filter?.limit !== void 0 && { limit: filter.limit },
874
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
875
+ ...filter?.includeTombstoned !== void 0 && {
876
+ includeTombstoned: filter.includeTombstoned
877
+ }
878
+ }
879
+ });
880
+ },
881
+ async get(blockId, version) {
882
+ return transport.request({
883
+ method: "GET",
884
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}`
885
+ });
886
+ },
887
+ async unregister(blockId, version, options) {
888
+ return transport.request({
889
+ method: "POST",
890
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}/unregister`,
891
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
892
+ });
893
+ },
894
+ async reinstate(blockId, version, options) {
895
+ return transport.request({
896
+ method: "POST",
897
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}/reinstate`,
898
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
899
+ });
900
+ }
901
+ }
902
+ };
903
+ }
904
+
812
905
  // src/resources/capabilities.ts
813
906
  function makeCapabilitiesClient(transport) {
814
907
  return {
@@ -962,6 +1055,7 @@ function makeConversationsClient(transport) {
962
1055
  body: {
963
1056
  agentId: input.agentId,
964
1057
  agentVersion: input.agentVersion,
1058
+ ...input.projectId !== void 0 && { projectId: input.projectId },
965
1059
  ...input.title !== void 0 && { title: input.title },
966
1060
  ...input.scope !== void 0 && { scope: input.scope },
967
1061
  ...input.participantId !== void 0 && { participantId: input.participantId },
@@ -987,6 +1081,7 @@ function makeConversationsClient(transport) {
987
1081
  ...filter?.limit !== void 0 && { limit: filter.limit },
988
1082
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
989
1083
  ...statusParam !== void 0 && { status: statusParam },
1084
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
990
1085
  ...filter?.agent !== void 0 && { agentId: filter.agent }
991
1086
  }
992
1087
  });
@@ -1023,6 +1118,29 @@ function makeConversationsClient(transport) {
1023
1118
  }
1024
1119
 
1025
1120
  // src/resources/cost.ts
1121
+ function filterQuery(filter) {
1122
+ const scope = filter.scope !== void 0 ? scopeToQuery(filter.scope) : void 0;
1123
+ return {
1124
+ ...filter.runId !== void 0 && { runId: filter.runId },
1125
+ ...filter.includeDescendants === true && { includeDescendants: "true" },
1126
+ ...filter.rootRunId !== void 0 && { rootRunId: filter.rootRunId },
1127
+ ...filter.agentId !== void 0 && { agentId: filter.agentId },
1128
+ ...filter.conversationId !== void 0 && {
1129
+ conversationId: filter.conversationId
1130
+ },
1131
+ ...filter.category !== void 0 && { category: filter.category },
1132
+ ...filter.providerId !== void 0 && {
1133
+ providerId: filter.providerId
1134
+ },
1135
+ ...filter.model !== void 0 && { model: filter.model },
1136
+ ...filter.servedModel !== void 0 && { servedModel: filter.servedModel },
1137
+ ...scope !== void 0 && { scopeKind: scope.scopeKind },
1138
+ ...scope?.scopeId !== void 0 && { scopeId: scope.scopeId },
1139
+ ...filter.from !== void 0 && { from: filter.from },
1140
+ ...filter.to !== void 0 && { to: filter.to },
1141
+ ...filter.includeRawUsage === true && { include: "rawUsage" }
1142
+ };
1143
+ }
1026
1144
  function makeCostClient(transport) {
1027
1145
  return {
1028
1146
  usage: {
@@ -1033,17 +1151,7 @@ function makeCostClient(transport) {
1033
1151
  query: {
1034
1152
  ...filter?.limit !== void 0 && { limit: filter.limit },
1035
1153
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1036
- ...filter?.runId !== void 0 && { runId: filter.runId },
1037
- ...filter?.agentId !== void 0 && { agentId: filter.agentId },
1038
- ...filter?.conversationId !== void 0 && {
1039
- conversationId: filter.conversationId
1040
- },
1041
- ...filter?.category !== void 0 && { category: filter.category },
1042
- ...filter?.providerId !== void 0 && {
1043
- providerId: filter.providerId
1044
- },
1045
- ...filter?.from !== void 0 && { from: filter.from },
1046
- ...filter?.to !== void 0 && { to: filter.to }
1154
+ ...filterQuery(filter ?? {})
1047
1155
  }
1048
1156
  });
1049
1157
  return {
@@ -1053,29 +1161,23 @@ function makeCostClient(transport) {
1053
1161
  }
1054
1162
  };
1055
1163
  },
1056
- async get(recordId) {
1164
+ async get(recordId, options) {
1057
1165
  return transport.request({
1058
1166
  method: "GET",
1059
- path: `/v1/cost/records/${encodeURIComponent(recordId)}`
1167
+ path: `/v1/cost/records/${encodeURIComponent(recordId)}`,
1168
+ ...options?.includeRawUsage === true && { query: { include: "rawUsage" } }
1060
1169
  });
1061
1170
  },
1062
1171
  async summary(input) {
1172
+ const { from, to, groupBy, ...filter } = input;
1063
1173
  return transport.request({
1064
1174
  method: "GET",
1065
1175
  path: "/v1/cost/aggregate",
1066
1176
  query: {
1067
- from: input.from,
1068
- to: input.to,
1069
- ...input.groupBy !== void 0 && { groupBy: input.groupBy.join(",") },
1070
- ...input.category !== void 0 && { category: input.category },
1071
- ...input.providerId !== void 0 && {
1072
- providerId: input.providerId
1073
- },
1074
- ...input.agentId !== void 0 && { agentId: input.agentId },
1075
- ...input.runId !== void 0 && { runId: input.runId },
1076
- ...input.conversationId !== void 0 && {
1077
- conversationId: input.conversationId
1078
- }
1177
+ ...filterQuery(filter),
1178
+ from,
1179
+ to,
1180
+ ...groupBy !== void 0 && { groupBy: groupBy.join(",") }
1079
1181
  }
1080
1182
  });
1081
1183
  }
@@ -1149,20 +1251,6 @@ function makeDeploymentsClient(transport) {
1149
1251
  };
1150
1252
  }
1151
1253
 
1152
- // src/scope-wire.ts
1153
- function scopeForBody(scope) {
1154
- if (scope.kind === "tenant") return { kind: "tenant" };
1155
- if (scope.kind === "org") return { kind: "org", orgId: scope.orgId };
1156
- return { kind: "project", projectId: scope.projectId };
1157
- }
1158
- function scopeToQuery(scope) {
1159
- if (scope.kind === "tenant") return { scopeKind: "tenant" };
1160
- if (scope.kind === "org") {
1161
- return { scopeKind: "org", scopeId: scope.orgId };
1162
- }
1163
- return { scopeKind: "project", scopeId: scope.projectId };
1164
- }
1165
-
1166
1254
  // src/resources/env.ts
1167
1255
  function makeEnvClient(transport) {
1168
1256
  return {
@@ -1366,6 +1454,24 @@ function makeEvalSuitesClient(transport) {
1366
1454
  path: `/v1/eval-suites/${seg(suiteId)}`
1367
1455
  });
1368
1456
  },
1457
+ async buildFromJudgments(suiteId, input, options) {
1458
+ return transport.request({
1459
+ method: "POST",
1460
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/from-judgments`,
1461
+ body: input,
1462
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1463
+ });
1464
+ },
1465
+ async listCases(suiteId, version, query) {
1466
+ return transport.request({
1467
+ method: "GET",
1468
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/${seg(version)}/cases`,
1469
+ query: {
1470
+ ...query?.limit !== void 0 && { limit: query.limit },
1471
+ ...query?.cursor !== void 0 && { cursor: query.cursor }
1472
+ }
1473
+ });
1474
+ },
1369
1475
  versions: {
1370
1476
  async list(suiteId, filter) {
1371
1477
  return transport.request({
@@ -1749,6 +1855,115 @@ function makeIdentityClient(transport) {
1749
1855
  };
1750
1856
  }
1751
1857
 
1858
+ // src/resources/judge-classes.ts
1859
+ function scopeQuery(scope) {
1860
+ if (scope.kind === "tenant") return { scopeKind: "tenant" };
1861
+ if (scope.kind === "project") return { scopeKind: "project", projectId: scope.projectId };
1862
+ return { scopeKind: "agent", projectId: scope.projectId, agentId: scope.agentId };
1863
+ }
1864
+ function makeJudgeClassesClient(transport) {
1865
+ const withKey = (options) => options?.idempotencyKey !== void 0 ? { idempotencyKey: options.idempotencyKey } : {};
1866
+ return {
1867
+ async create(input, options) {
1868
+ return transport.request({
1869
+ method: "POST",
1870
+ path: "/v1/judge-classes",
1871
+ body: input,
1872
+ ...withKey(options)
1873
+ });
1874
+ },
1875
+ async list(filter) {
1876
+ const page = await transport.request({
1877
+ method: "GET",
1878
+ path: "/v1/judge-classes",
1879
+ query: {
1880
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1881
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1882
+ ...filter?.scope !== void 0 && scopeQuery(filter.scope)
1883
+ }
1884
+ });
1885
+ return {
1886
+ items: page.data,
1887
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
1888
+ };
1889
+ },
1890
+ async get(judgeClassId) {
1891
+ return transport.request({
1892
+ method: "GET",
1893
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}`
1894
+ });
1895
+ },
1896
+ async update(judgeClassId, input, options) {
1897
+ return transport.request({
1898
+ method: "PATCH",
1899
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}`,
1900
+ body: input,
1901
+ ...withKey(options)
1902
+ });
1903
+ },
1904
+ async unregister(judgeClassId, options) {
1905
+ await transport.request({
1906
+ method: "POST",
1907
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}/unregister`,
1908
+ body: {},
1909
+ discardResponse: true,
1910
+ ...withKey(options)
1911
+ });
1912
+ }
1913
+ };
1914
+ }
1915
+
1916
+ // src/resources/judgments.ts
1917
+ function makeJudgmentsClient(transport) {
1918
+ return {
1919
+ async create(input, options) {
1920
+ return transport.request({
1921
+ method: "POST",
1922
+ path: "/v1/judgments",
1923
+ body: input,
1924
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1925
+ });
1926
+ },
1927
+ async list(filter) {
1928
+ const page = await transport.request({
1929
+ method: "GET",
1930
+ path: "/v1/judgments",
1931
+ query: {
1932
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1933
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1934
+ ...filter?.runId !== void 0 && { runId: filter.runId },
1935
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
1936
+ ...filter?.agentVersion !== void 0 && { agentVersion: filter.agentVersion },
1937
+ ...filter?.flowId !== void 0 && { flowId: filter.flowId },
1938
+ ...filter?.verdict !== void 0 && { verdict: filter.verdict },
1939
+ ...filter?.judgeClassId !== void 0 && { judgeClassId: filter.judgeClassId },
1940
+ ...filter?.participantId !== void 0 && { participantId: filter.participantId },
1941
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope)
1942
+ }
1943
+ });
1944
+ return {
1945
+ items: page.data,
1946
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
1947
+ };
1948
+ },
1949
+ async get(judgmentId) {
1950
+ return transport.request({
1951
+ method: "GET",
1952
+ path: `/v1/judgments/${encodeURIComponent(judgmentId)}`
1953
+ });
1954
+ },
1955
+ async unregister(judgmentId, options) {
1956
+ await transport.request({
1957
+ method: "POST",
1958
+ path: `/v1/judgments/${encodeURIComponent(judgmentId)}/unregister`,
1959
+ body: {},
1960
+ discardResponse: true,
1961
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1962
+ });
1963
+ }
1964
+ };
1965
+ }
1966
+
1752
1967
  // src/resources/mcp.ts
1753
1968
  function makeMcpClient(transport) {
1754
1969
  return {
@@ -2325,6 +2540,7 @@ function makeProvenanceClient(transport) {
2325
2540
  query: {
2326
2541
  ...filter?.limit !== void 0 && { limit: filter.limit },
2327
2542
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2543
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
2328
2544
  ...filter?.runId !== void 0 && { runId: filter.runId },
2329
2545
  ...filter?.agentId !== void 0 && {
2330
2546
  agentId: filter.agentId
@@ -2580,10 +2796,14 @@ function makeRunsClient(transport) {
2580
2796
  query: {
2581
2797
  ...filter?.limit !== void 0 && { limit: filter.limit },
2582
2798
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2799
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
2583
2800
  ...filter?.parentRunId !== void 0 && {
2584
2801
  parentRunId: filter.parentRunId
2585
2802
  },
2586
2803
  ...filter?.topLevel !== void 0 && { topLevel: String(filter.topLevel) },
2804
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
2805
+ ...filter?.replays !== void 0 && { replays: filter.replays },
2806
+ ...filter?.evalRunId !== void 0 && { evalRunId: filter.evalRunId },
2587
2807
  ...filter?.includeOutput === true && { include: "output" }
2588
2808
  }
2589
2809
  });
@@ -3777,7 +3997,10 @@ function createClient(options) {
3777
3997
  compliance: makeComplianceClient(transport),
3778
3998
  audit: makeAuditClient(transport),
3779
3999
  evalSuites: makeEvalSuitesClient(transport),
4000
+ blocks: makeBlocksClient(transport),
3780
4001
  evalRuns: makeEvalRunsClient(transport),
4002
+ judgments: makeJudgmentsClient(transport),
4003
+ judgeClasses: makeJudgeClassesClient(transport),
3781
4004
  users: makeUsersClient(transport),
3782
4005
  identity: makeIdentityClient(transport),
3783
4006
  auth: makeAuthClient(transport),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kindgi/client",
3
- "version": "0.1.2",
3
+ "version": "0.1.4-rc.0",
4
4
  "description": "TypeScript client SDK for Kindgi™ — the sovereign AI OS. Preview: wire-generated from openapi.json via typed-openapi, ergonomic hand-authored resource clients (Transport, KindgiApiError, SSE with Last-Event-Id resume).",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -45,12 +45,12 @@
45
45
  "zod": "^4.6.5"
46
46
  },
47
47
  "devDependencies": {
48
- "@kindgi/agents": "0.1.2",
49
- "@kindgi/api": "0.1.2",
50
- "@kindgi/flow": "0.1.2",
51
- "@kindgi/platform": "0.1.2",
52
- "@kindgi/runtime": "0.1.2",
53
- "@kindgi/types": "0.1.2",
48
+ "@kindgi/agents": "0.1.4-rc.0",
49
+ "@kindgi/api": "0.1.4-rc.0",
50
+ "@kindgi/flow": "0.1.4-rc.0",
51
+ "@kindgi/platform": "0.1.4-rc.0",
52
+ "@kindgi/runtime": "0.1.4-rc.0",
53
+ "@kindgi/types": "0.1.4-rc.0",
54
54
  "@types/node": "^22.10.5",
55
55
  "dts-bundle-generator": "^9.5.1",
56
56
  "tsup": "^8.5.1",