@kindgi/client 0.1.3 → 0.1.4-rc.1

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,9 @@ 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":
112
+ case "registry-read-only":
110
113
  return { code: "conflict", message, reason: code };
111
114
  case "invalid-request":
112
115
  case "validation-failed":
@@ -461,6 +464,16 @@ function makeAgentsClient(transport) {
461
464
  idempotencyKey: options.idempotencyKey
462
465
  }
463
466
  });
467
+ },
468
+ async derive(agentId, input, options) {
469
+ return transport.request({
470
+ method: "POST",
471
+ path: `/v1/agents/${seg(agentId)}/versions`,
472
+ body: input,
473
+ ...options?.idempotencyKey !== void 0 && {
474
+ idempotencyKey: options.idempotencyKey
475
+ }
476
+ });
464
477
  }
465
478
  },
466
479
  async reinstateVersion(agentId, version, options) {
@@ -826,6 +839,72 @@ function makeAuthClient(transport) {
826
839
  };
827
840
  }
828
841
 
842
+ // src/resources/blocks.ts
843
+ function makeBlocksClient(transport) {
844
+ const seg = (s) => encodeURIComponent(s);
845
+ return {
846
+ async publish(input, options) {
847
+ return transport.request({
848
+ method: "POST",
849
+ path: "/v1/blocks",
850
+ body: { ...input, projectId: options.projectId },
851
+ ...options.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
852
+ });
853
+ },
854
+ async list(filter) {
855
+ return transport.request({
856
+ method: "GET",
857
+ path: "/v1/blocks",
858
+ query: {
859
+ ...filter?.limit !== void 0 && { limit: filter.limit },
860
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
861
+ ...filter?.kind !== void 0 && { kind: filter.kind },
862
+ ...filter?.name !== void 0 && { name: filter.name },
863
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope)
864
+ }
865
+ });
866
+ },
867
+ async get(blockId) {
868
+ return transport.request({ method: "GET", path: `/v1/blocks/${seg(blockId)}` });
869
+ },
870
+ versions: {
871
+ async list(blockId, filter) {
872
+ return transport.request({
873
+ method: "GET",
874
+ path: `/v1/blocks/${seg(blockId)}/versions`,
875
+ query: {
876
+ ...filter?.limit !== void 0 && { limit: filter.limit },
877
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
878
+ ...filter?.includeTombstoned !== void 0 && {
879
+ includeTombstoned: filter.includeTombstoned
880
+ }
881
+ }
882
+ });
883
+ },
884
+ async get(blockId, version) {
885
+ return transport.request({
886
+ method: "GET",
887
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}`
888
+ });
889
+ },
890
+ async unregister(blockId, version, options) {
891
+ return transport.request({
892
+ method: "POST",
893
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}/unregister`,
894
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
895
+ });
896
+ },
897
+ async reinstate(blockId, version, options) {
898
+ return transport.request({
899
+ method: "POST",
900
+ path: `/v1/blocks/${seg(blockId)}/versions/${seg(version)}/reinstate`,
901
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
902
+ });
903
+ }
904
+ }
905
+ };
906
+ }
907
+
829
908
  // src/resources/capabilities.ts
830
909
  function makeCapabilitiesClient(transport) {
831
910
  return {
@@ -1290,6 +1369,10 @@ function tryReadRevisionConflict(err) {
1290
1369
  }
1291
1370
 
1292
1371
  // src/resources/eval-runs.ts
1372
+ function comparisonOf(run) {
1373
+ const result = run.result;
1374
+ return run.kind === "judged" && result?.summary !== void 0 && Array.isArray(result.perCase) ? result : void 0;
1375
+ }
1293
1376
  function makeEvalRunsClient(transport) {
1294
1377
  const seg = (s) => encodeURIComponent(s);
1295
1378
  return {
@@ -1378,6 +1461,24 @@ function makeEvalSuitesClient(transport) {
1378
1461
  path: `/v1/eval-suites/${seg(suiteId)}`
1379
1462
  });
1380
1463
  },
1464
+ async buildFromJudgments(suiteId, input, options) {
1465
+ return transport.request({
1466
+ method: "POST",
1467
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/from-judgments`,
1468
+ body: input,
1469
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1470
+ });
1471
+ },
1472
+ async listCases(suiteId, version, query) {
1473
+ return transport.request({
1474
+ method: "GET",
1475
+ path: `/v1/eval-suites/${seg(suiteId)}/versions/${seg(version)}/cases`,
1476
+ query: {
1477
+ ...query?.limit !== void 0 && { limit: query.limit },
1478
+ ...query?.cursor !== void 0 && { cursor: query.cursor }
1479
+ }
1480
+ });
1481
+ },
1381
1482
  versions: {
1382
1483
  async list(suiteId, filter) {
1383
1484
  return transport.request({
@@ -1761,6 +1862,115 @@ function makeIdentityClient(transport) {
1761
1862
  };
1762
1863
  }
1763
1864
 
1865
+ // src/resources/judge-classes.ts
1866
+ function scopeQuery(scope) {
1867
+ if (scope.kind === "tenant") return { scopeKind: "tenant" };
1868
+ if (scope.kind === "project") return { scopeKind: "project", projectId: scope.projectId };
1869
+ return { scopeKind: "agent", projectId: scope.projectId, agentId: scope.agentId };
1870
+ }
1871
+ function makeJudgeClassesClient(transport) {
1872
+ const withKey = (options) => options?.idempotencyKey !== void 0 ? { idempotencyKey: options.idempotencyKey } : {};
1873
+ return {
1874
+ async create(input, options) {
1875
+ return transport.request({
1876
+ method: "POST",
1877
+ path: "/v1/judge-classes",
1878
+ body: input,
1879
+ ...withKey(options)
1880
+ });
1881
+ },
1882
+ async list(filter) {
1883
+ const page = await transport.request({
1884
+ method: "GET",
1885
+ path: "/v1/judge-classes",
1886
+ query: {
1887
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1888
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1889
+ ...filter?.scope !== void 0 && scopeQuery(filter.scope)
1890
+ }
1891
+ });
1892
+ return {
1893
+ items: page.data,
1894
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
1895
+ };
1896
+ },
1897
+ async get(judgeClassId) {
1898
+ return transport.request({
1899
+ method: "GET",
1900
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}`
1901
+ });
1902
+ },
1903
+ async update(judgeClassId, input, options) {
1904
+ return transport.request({
1905
+ method: "PATCH",
1906
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}`,
1907
+ body: input,
1908
+ ...withKey(options)
1909
+ });
1910
+ },
1911
+ async unregister(judgeClassId, options) {
1912
+ await transport.request({
1913
+ method: "POST",
1914
+ path: `/v1/judge-classes/${encodeURIComponent(judgeClassId)}/unregister`,
1915
+ body: {},
1916
+ discardResponse: true,
1917
+ ...withKey(options)
1918
+ });
1919
+ }
1920
+ };
1921
+ }
1922
+
1923
+ // src/resources/judgments.ts
1924
+ function makeJudgmentsClient(transport) {
1925
+ return {
1926
+ async create(input, options) {
1927
+ return transport.request({
1928
+ method: "POST",
1929
+ path: "/v1/judgments",
1930
+ body: input,
1931
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1932
+ });
1933
+ },
1934
+ async list(filter) {
1935
+ const page = await transport.request({
1936
+ method: "GET",
1937
+ path: "/v1/judgments",
1938
+ query: {
1939
+ ...filter?.limit !== void 0 && { limit: filter.limit },
1940
+ ...filter?.cursor !== void 0 && { cursor: filter.cursor },
1941
+ ...filter?.runId !== void 0 && { runId: filter.runId },
1942
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
1943
+ ...filter?.agentVersion !== void 0 && { agentVersion: filter.agentVersion },
1944
+ ...filter?.flowId !== void 0 && { flowId: filter.flowId },
1945
+ ...filter?.verdict !== void 0 && { verdict: filter.verdict },
1946
+ ...filter?.judgeClassId !== void 0 && { judgeClassId: filter.judgeClassId },
1947
+ ...filter?.participantId !== void 0 && { participantId: filter.participantId },
1948
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope)
1949
+ }
1950
+ });
1951
+ return {
1952
+ items: page.data,
1953
+ ...page.nextCursor !== void 0 && { nextCursor: page.nextCursor }
1954
+ };
1955
+ },
1956
+ async get(judgmentId) {
1957
+ return transport.request({
1958
+ method: "GET",
1959
+ path: `/v1/judgments/${encodeURIComponent(judgmentId)}`
1960
+ });
1961
+ },
1962
+ async unregister(judgmentId, options) {
1963
+ await transport.request({
1964
+ method: "POST",
1965
+ path: `/v1/judgments/${encodeURIComponent(judgmentId)}/unregister`,
1966
+ body: {},
1967
+ discardResponse: true,
1968
+ ...options?.idempotencyKey !== void 0 && { idempotencyKey: options.idempotencyKey }
1969
+ });
1970
+ }
1971
+ };
1972
+ }
1973
+
1764
1974
  // src/resources/mcp.ts
1765
1975
  function makeMcpClient(transport) {
1766
1976
  return {
@@ -2599,6 +2809,8 @@ function makeRunsClient(transport) {
2599
2809
  },
2600
2810
  ...filter?.topLevel !== void 0 && { topLevel: String(filter.topLevel) },
2601
2811
  ...filter?.agentId !== void 0 && { agentId: filter.agentId },
2812
+ ...filter?.replays !== void 0 && { replays: filter.replays },
2813
+ ...filter?.evalRunId !== void 0 && { evalRunId: filter.evalRunId },
2602
2814
  ...filter?.includeOutput === true && { include: "output" }
2603
2815
  }
2604
2816
  });
@@ -3792,7 +4004,10 @@ function createClient(options) {
3792
4004
  compliance: makeComplianceClient(transport),
3793
4005
  audit: makeAuditClient(transport),
3794
4006
  evalSuites: makeEvalSuitesClient(transport),
4007
+ blocks: makeBlocksClient(transport),
3795
4008
  evalRuns: makeEvalRunsClient(transport),
4009
+ judgments: makeJudgmentsClient(transport),
4010
+ judgeClasses: makeJudgeClassesClient(transport),
3796
4011
  users: makeUsersClient(transport),
3797
4012
  identity: makeIdentityClient(transport),
3798
4013
  auth: makeAuthClient(transport),
@@ -3812,6 +4027,7 @@ function createClient(options) {
3812
4027
 
3813
4028
  exports.KindgiApiError = KindgiApiError;
3814
4029
  exports.SseHttpError = SseHttpError;
4030
+ exports.comparisonOf = comparisonOf;
3815
4031
  exports.createClient = createClient;
3816
4032
  exports.followRun = followRun;
3817
4033
  exports.fromWire = fromWire;