@kindgi/client 0.1.1 → 0.1.3

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
@@ -478,6 +478,20 @@ function makeAgentsClient(transport) {
478
478
  };
479
479
  }
480
480
 
481
+ // src/scope-wire.ts
482
+ function scopeForBody(scope) {
483
+ if (scope.kind === "tenant") return { kind: "tenant" };
484
+ if (scope.kind === "org") return { kind: "org", orgId: scope.orgId };
485
+ return { kind: "project", projectId: scope.projectId };
486
+ }
487
+ function scopeToQuery(scope) {
488
+ if (scope.kind === "tenant") return { scopeKind: "tenant" };
489
+ if (scope.kind === "org") {
490
+ return { scopeKind: "org", scopeId: scope.orgId };
491
+ }
492
+ return { scopeKind: "project", scopeId: scope.projectId };
493
+ }
494
+
481
495
  // src/status-query.ts
482
496
  function singleStatusQuery(method, status) {
483
497
  if (status === void 0) return void 0;
@@ -504,6 +518,7 @@ function makeApprovalsClient(transport) {
504
518
  ...filter?.limit !== void 0 && { limit: filter.limit },
505
519
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
506
520
  ...statusParam !== void 0 && { status: statusParam },
521
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
507
522
  ...filter?.requiredRole !== void 0 && { requiredRole: filter.requiredRole },
508
523
  ...filter?.createdAfter !== void 0 && {
509
524
  createdAfter: filter.createdAfter
@@ -962,6 +977,7 @@ function makeConversationsClient(transport) {
962
977
  body: {
963
978
  agentId: input.agentId,
964
979
  agentVersion: input.agentVersion,
980
+ ...input.projectId !== void 0 && { projectId: input.projectId },
965
981
  ...input.title !== void 0 && { title: input.title },
966
982
  ...input.scope !== void 0 && { scope: input.scope },
967
983
  ...input.participantId !== void 0 && { participantId: input.participantId },
@@ -987,6 +1003,7 @@ function makeConversationsClient(transport) {
987
1003
  ...filter?.limit !== void 0 && { limit: filter.limit },
988
1004
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
989
1005
  ...statusParam !== void 0 && { status: statusParam },
1006
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
990
1007
  ...filter?.agent !== void 0 && { agentId: filter.agent }
991
1008
  }
992
1009
  });
@@ -1023,6 +1040,29 @@ function makeConversationsClient(transport) {
1023
1040
  }
1024
1041
 
1025
1042
  // src/resources/cost.ts
1043
+ function filterQuery(filter) {
1044
+ const scope = filter.scope !== void 0 ? scopeToQuery(filter.scope) : void 0;
1045
+ return {
1046
+ ...filter.runId !== void 0 && { runId: filter.runId },
1047
+ ...filter.includeDescendants === true && { includeDescendants: "true" },
1048
+ ...filter.rootRunId !== void 0 && { rootRunId: filter.rootRunId },
1049
+ ...filter.agentId !== void 0 && { agentId: filter.agentId },
1050
+ ...filter.conversationId !== void 0 && {
1051
+ conversationId: filter.conversationId
1052
+ },
1053
+ ...filter.category !== void 0 && { category: filter.category },
1054
+ ...filter.providerId !== void 0 && {
1055
+ providerId: filter.providerId
1056
+ },
1057
+ ...filter.model !== void 0 && { model: filter.model },
1058
+ ...filter.servedModel !== void 0 && { servedModel: filter.servedModel },
1059
+ ...scope !== void 0 && { scopeKind: scope.scopeKind },
1060
+ ...scope?.scopeId !== void 0 && { scopeId: scope.scopeId },
1061
+ ...filter.from !== void 0 && { from: filter.from },
1062
+ ...filter.to !== void 0 && { to: filter.to },
1063
+ ...filter.includeRawUsage === true && { include: "rawUsage" }
1064
+ };
1065
+ }
1026
1066
  function makeCostClient(transport) {
1027
1067
  return {
1028
1068
  usage: {
@@ -1033,17 +1073,7 @@ function makeCostClient(transport) {
1033
1073
  query: {
1034
1074
  ...filter?.limit !== void 0 && { limit: filter.limit },
1035
1075
  ...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 }
1076
+ ...filterQuery(filter ?? {})
1047
1077
  }
1048
1078
  });
1049
1079
  return {
@@ -1053,29 +1083,23 @@ function makeCostClient(transport) {
1053
1083
  }
1054
1084
  };
1055
1085
  },
1056
- async get(recordId) {
1086
+ async get(recordId, options) {
1057
1087
  return transport.request({
1058
1088
  method: "GET",
1059
- path: `/v1/cost/records/${encodeURIComponent(recordId)}`
1089
+ path: `/v1/cost/records/${encodeURIComponent(recordId)}`,
1090
+ ...options?.includeRawUsage === true && { query: { include: "rawUsage" } }
1060
1091
  });
1061
1092
  },
1062
1093
  async summary(input) {
1094
+ const { from, to, groupBy, ...filter } = input;
1063
1095
  return transport.request({
1064
1096
  method: "GET",
1065
1097
  path: "/v1/cost/aggregate",
1066
1098
  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
- }
1099
+ ...filterQuery(filter),
1100
+ from,
1101
+ to,
1102
+ ...groupBy !== void 0 && { groupBy: groupBy.join(",") }
1079
1103
  }
1080
1104
  });
1081
1105
  }
@@ -1149,20 +1173,6 @@ function makeDeploymentsClient(transport) {
1149
1173
  };
1150
1174
  }
1151
1175
 
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
1176
  // src/resources/env.ts
1167
1177
  function makeEnvClient(transport) {
1168
1178
  return {
@@ -2325,6 +2335,7 @@ function makeProvenanceClient(transport) {
2325
2335
  query: {
2326
2336
  ...filter?.limit !== void 0 && { limit: filter.limit },
2327
2337
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2338
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
2328
2339
  ...filter?.runId !== void 0 && { runId: filter.runId },
2329
2340
  ...filter?.agentId !== void 0 && {
2330
2341
  agentId: filter.agentId
@@ -2580,10 +2591,12 @@ function makeRunsClient(transport) {
2580
2591
  query: {
2581
2592
  ...filter?.limit !== void 0 && { limit: filter.limit },
2582
2593
  ...filter?.cursor !== void 0 && { cursor: filter.cursor },
2594
+ ...filter?.scope !== void 0 && scopeToQuery(filter.scope),
2583
2595
  ...filter?.parentRunId !== void 0 && {
2584
2596
  parentRunId: filter.parentRunId
2585
2597
  },
2586
2598
  ...filter?.topLevel !== void 0 && { topLevel: String(filter.topLevel) },
2599
+ ...filter?.agentId !== void 0 && { agentId: filter.agentId },
2587
2600
  ...filter?.includeOutput === true && { include: "output" }
2588
2601
  }
2589
2602
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kindgi/client",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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.1",
49
- "@kindgi/api": "0.1.1",
50
- "@kindgi/flow": "0.1.1",
51
- "@kindgi/platform": "0.1.1",
52
- "@kindgi/runtime": "0.1.1",
53
- "@kindgi/types": "0.1.1",
48
+ "@kindgi/agents": "0.1.3",
49
+ "@kindgi/api": "0.1.3",
50
+ "@kindgi/flow": "0.1.3",
51
+ "@kindgi/platform": "0.1.3",
52
+ "@kindgi/runtime": "0.1.3",
53
+ "@kindgi/types": "0.1.3",
54
54
  "@types/node": "^22.10.5",
55
55
  "dts-bundle-generator": "^9.5.1",
56
56
  "tsup": "^8.5.1",
@@ -59,7 +59,7 @@
59
59
  "vitest": "^2.1.8"
60
60
  },
61
61
  "engines": {
62
- "node": ">=22.0.0"
62
+ "node": ">=22.12.0"
63
63
  },
64
64
  "scripts": {
65
65
  "gen": "node scripts/gen-client.mjs",