@truefoundry/trueforge-sdk 0.1.4-rc.1 → 0.1.4-rc.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 (64) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/internal/resources/sessions/client/requests/GetOrCreateSessionByExternalIdRequest.d.ts +1 -0
  3. package/dist/cjs/api/resources/sessions/client/Client.d.ts +1 -1
  4. package/dist/cjs/api/resources/sessions/client/Client.js +12 -2
  5. package/dist/cjs/api/resources/sessions/client/requests/ListSessionsRequest.d.ts +6 -0
  6. package/dist/cjs/api/types/Session.d.ts +1 -0
  7. package/dist/cjs/api/types/SessionMetrics.d.ts +2 -1
  8. package/dist/cjs/api/types/SessionSource.d.ts +11 -0
  9. package/dist/cjs/api/types/SessionSource.js +3 -0
  10. package/dist/cjs/api/types/SessionSourceSchedule.d.ts +8 -0
  11. package/dist/cjs/api/types/SessionSourceSchedule.js +3 -0
  12. package/dist/cjs/api/types/SessionSourceType.d.ts +4 -0
  13. package/dist/cjs/api/types/SessionSourceType.js +3 -0
  14. package/dist/cjs/api/types/index.d.ts +3 -0
  15. package/dist/cjs/api/types/index.js +3 -0
  16. package/dist/cjs/serialization/resources/internal/resources/sessions/client/requests/GetOrCreateSessionByExternalIdRequest.d.ts +2 -0
  17. package/dist/cjs/serialization/resources/internal/resources/sessions/client/requests/GetOrCreateSessionByExternalIdRequest.js +2 -0
  18. package/dist/cjs/serialization/types/Session.d.ts +2 -0
  19. package/dist/cjs/serialization/types/Session.js +2 -0
  20. package/dist/cjs/serialization/types/SessionMetrics.d.ts +1 -1
  21. package/dist/cjs/serialization/types/SessionMetrics.js +1 -1
  22. package/dist/cjs/serialization/types/SessionSource.d.ts +11 -0
  23. package/dist/cjs/serialization/types/SessionSource.js +43 -0
  24. package/dist/cjs/serialization/types/SessionSourceSchedule.d.ts +11 -0
  25. package/dist/cjs/serialization/types/SessionSourceSchedule.js +43 -0
  26. package/dist/cjs/serialization/types/SessionSourceType.d.ts +7 -0
  27. package/dist/cjs/serialization/types/SessionSourceType.js +39 -0
  28. package/dist/cjs/serialization/types/index.d.ts +3 -0
  29. package/dist/cjs/serialization/types/index.js +3 -0
  30. package/dist/cjs/version.d.ts +1 -1
  31. package/dist/cjs/version.js +1 -1
  32. package/dist/esm/BaseClient.mjs +2 -2
  33. package/dist/esm/api/resources/internal/resources/sessions/client/requests/GetOrCreateSessionByExternalIdRequest.d.mts +1 -0
  34. package/dist/esm/api/resources/sessions/client/Client.d.mts +1 -1
  35. package/dist/esm/api/resources/sessions/client/Client.mjs +12 -2
  36. package/dist/esm/api/resources/sessions/client/requests/ListSessionsRequest.d.mts +6 -0
  37. package/dist/esm/api/types/Session.d.mts +1 -0
  38. package/dist/esm/api/types/SessionMetrics.d.mts +2 -1
  39. package/dist/esm/api/types/SessionSource.d.mts +11 -0
  40. package/dist/esm/api/types/SessionSource.mjs +2 -0
  41. package/dist/esm/api/types/SessionSourceSchedule.d.mts +8 -0
  42. package/dist/esm/api/types/SessionSourceSchedule.mjs +2 -0
  43. package/dist/esm/api/types/SessionSourceType.d.mts +4 -0
  44. package/dist/esm/api/types/SessionSourceType.mjs +2 -0
  45. package/dist/esm/api/types/index.d.mts +3 -0
  46. package/dist/esm/api/types/index.mjs +3 -0
  47. package/dist/esm/serialization/resources/internal/resources/sessions/client/requests/GetOrCreateSessionByExternalIdRequest.d.mts +2 -0
  48. package/dist/esm/serialization/resources/internal/resources/sessions/client/requests/GetOrCreateSessionByExternalIdRequest.mjs +2 -0
  49. package/dist/esm/serialization/types/Session.d.mts +2 -0
  50. package/dist/esm/serialization/types/Session.mjs +2 -0
  51. package/dist/esm/serialization/types/SessionMetrics.d.mts +1 -1
  52. package/dist/esm/serialization/types/SessionMetrics.mjs +1 -1
  53. package/dist/esm/serialization/types/SessionSource.d.mts +11 -0
  54. package/dist/esm/serialization/types/SessionSource.mjs +7 -0
  55. package/dist/esm/serialization/types/SessionSourceSchedule.d.mts +11 -0
  56. package/dist/esm/serialization/types/SessionSourceSchedule.mjs +7 -0
  57. package/dist/esm/serialization/types/SessionSourceType.d.mts +7 -0
  58. package/dist/esm/serialization/types/SessionSourceType.mjs +3 -0
  59. package/dist/esm/serialization/types/index.d.mts +3 -0
  60. package/dist/esm/serialization/types/index.mjs +3 -0
  61. package/dist/esm/version.d.mts +1 -1
  62. package/dist/esm/version.mjs +1 -1
  63. package/package.json +1 -1
  64. package/reference.md +1 -1
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@truefoundry/trueforge-sdk",
46
- "X-Fern-SDK-Version": "0.1.4-rc.1",
47
- "User-Agent": "@truefoundry/trueforge-sdk/0.1.4-rc.1",
46
+ "X-Fern-SDK-Version": "0.1.4-rc.2",
47
+ "User-Agent": "@truefoundry/trueforge-sdk/0.1.4-rc.2",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -12,4 +12,5 @@ export interface GetOrCreateSessionByExternalIdRequest {
12
12
  agent: TrueForge.CreateSessionAgent;
13
13
  /** Caller-supplied id unique within the tenant. */
14
14
  externalId: string;
15
+ source?: TrueForge.SessionSourceSchedule;
15
16
  }
@@ -11,7 +11,7 @@ export declare class SessionsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<SessionsClient.Options>;
12
12
  constructor(options: SessionsClient.Options);
13
13
  /**
14
- * List the caller's sessions (newest first by default).
14
+ * List the sessions (newest first by default).
15
15
  *
16
16
  * @param {TrueForge.ListSessionsRequest} request
17
17
  * @param {SessionsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -57,7 +57,7 @@ class SessionsClient {
57
57
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
58
58
  }
59
59
  /**
60
- * List the caller's sessions (newest first by default).
60
+ * List the sessions (newest first by default).
61
61
  *
62
62
  * @param {TrueForge.ListSessionsRequest} request
63
63
  * @param {SessionsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -73,7 +73,7 @@ class SessionsClient {
73
73
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
74
74
  const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
75
75
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
76
- const { limit = 25, order, pageToken, startTimestamp, endTimestamp, agentId, createdByMe } = request;
76
+ const { limit = 25, order, pageToken, startTimestamp, endTimestamp, agentId, createdByMe, metadata, sourceType, sourceId, } = request;
77
77
  const _queryParams = {
78
78
  limit,
79
79
  order: order != null
@@ -89,6 +89,16 @@ class SessionsClient {
89
89
  end_timestamp: endTimestamp != null ? endTimestamp === null || endTimestamp === void 0 ? void 0 : endTimestamp.toISOString() : undefined,
90
90
  agent_id: agentId,
91
91
  created_by_me: createdByMe,
92
+ metadata,
93
+ source_type: sourceType != null
94
+ ? serializers.SessionSourceType.jsonOrThrow(sourceType, {
95
+ unrecognizedObjectKeys: "passthrough",
96
+ allowUnrecognizedUnionMembers: true,
97
+ allowUnrecognizedEnumValues: true,
98
+ omitUndefined: true,
99
+ })
100
+ : undefined,
101
+ source_id: sourceId,
92
102
  };
93
103
  const _authRequest = yield this._options.authProvider.getAuthRequest();
94
104
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -18,4 +18,10 @@ export interface ListSessionsRequest {
18
18
  agentId?: string;
19
19
  /** When true, only sessions created by the authenticated subject. */
20
20
  createdByMe?: boolean;
21
+ /** Exact metadata pairs as metadata[key]=value. Sessions must contain all pairs. */
22
+ metadata?: TrueForge.SessionMetadata;
23
+ /** When set, returns only sessions created by this source type. */
24
+ sourceType?: TrueForge.SessionSourceType;
25
+ /** When set, returns only sessions from this specific source. Requires source_type. */
26
+ sourceId?: string;
21
27
  }
@@ -8,6 +8,7 @@ export interface Session {
8
8
  id: string;
9
9
  metadata: TrueForge.SessionMetadata;
10
10
  metrics: TrueForge.SessionMetrics;
11
+ source: TrueForge.SessionSource | null;
11
12
  /** Optional human-readable title; null until set. */
12
13
  title: string | null;
13
14
  /** ISO 8601 last-update timestamp. */
@@ -2,7 +2,8 @@
2
2
  * Rolled-up cost, duration, and turn counters for a session.
3
3
  */
4
4
  export interface SessionMetrics {
5
- totalCostInUsd: number;
5
+ /** Estimated total cost in USD for this session */
6
+ totalCostInUsd?: number;
6
7
  totalDurationMs: number;
7
8
  totalTurns: number;
8
9
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * How this session was created (e.g. a schedule run). Null for interactive sessions.
3
+ */
4
+ export interface SessionSource {
5
+ /** Schedule id. */
6
+ id: string;
7
+ /** Schedule run id. */
8
+ runId: string;
9
+ /** Session was created by a schedule run. */
10
+ type: "schedule";
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface SessionSourceSchedule {
2
+ /** Schedule id. */
3
+ id: string;
4
+ /** Schedule run id. */
5
+ runId: string;
6
+ /** Session was created by a schedule run. */
7
+ type: "schedule";
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ /**
2
+ * When set, returns only sessions created by this source type.
3
+ */
4
+ export type SessionSourceType = "schedule";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -172,6 +172,9 @@ export * from "./SessionMetricsMeter.js";
172
172
  export * from "./SessionMetricsMeterName.js";
173
173
  export * from "./SessionMetricsMeterResponse.js";
174
174
  export * from "./SessionMetricsPoint.js";
175
+ export * from "./SessionSource.js";
176
+ export * from "./SessionSourceSchedule.js";
177
+ export * from "./SessionSourceType.js";
175
178
  export * from "./SettingsCapability.js";
176
179
  export * from "./Skill.js";
177
180
  export * from "./SkillCapability.js";
@@ -188,6 +188,9 @@ __exportStar(require("./SessionMetricsMeter.js"), exports);
188
188
  __exportStar(require("./SessionMetricsMeterName.js"), exports);
189
189
  __exportStar(require("./SessionMetricsMeterResponse.js"), exports);
190
190
  __exportStar(require("./SessionMetricsPoint.js"), exports);
191
+ __exportStar(require("./SessionSource.js"), exports);
192
+ __exportStar(require("./SessionSourceSchedule.js"), exports);
193
+ __exportStar(require("./SessionSourceType.js"), exports);
191
194
  __exportStar(require("./SettingsCapability.js"), exports);
192
195
  __exportStar(require("./Skill.js"), exports);
193
196
  __exportStar(require("./SkillCapability.js"), exports);
@@ -2,10 +2,12 @@ import type * as TrueForge from "../../../../../../../api/index.js";
2
2
  import * as core from "../../../../../../../core/index.js";
3
3
  import type * as serializers from "../../../../../../index.js";
4
4
  import { CreateSessionAgent } from "../../../../../../types/CreateSessionAgent.js";
5
+ import { SessionSourceSchedule } from "../../../../../../types/SessionSourceSchedule.js";
5
6
  export declare const GetOrCreateSessionByExternalIdRequest: core.serialization.Schema<serializers.internal.GetOrCreateSessionByExternalIdRequest.Raw, TrueForge.internal.GetOrCreateSessionByExternalIdRequest>;
6
7
  export declare namespace GetOrCreateSessionByExternalIdRequest {
7
8
  interface Raw {
8
9
  agent: CreateSessionAgent.Raw;
9
10
  external_id: string;
11
+ source?: SessionSourceSchedule.Raw | null;
10
12
  }
11
13
  }
@@ -37,7 +37,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.GetOrCreateSessionByExternalIdRequest = void 0;
38
38
  const core = __importStar(require("../../../../../../../core/index.js"));
39
39
  const CreateSessionAgent_js_1 = require("../../../../../../types/CreateSessionAgent.js");
40
+ const SessionSourceSchedule_js_1 = require("../../../../../../types/SessionSourceSchedule.js");
40
41
  exports.GetOrCreateSessionByExternalIdRequest = core.serialization.object({
41
42
  agent: CreateSessionAgent_js_1.CreateSessionAgent,
42
43
  externalId: core.serialization.property("external_id", core.serialization.string()),
44
+ source: SessionSourceSchedule_js_1.SessionSourceSchedule.optional(),
43
45
  });
@@ -5,6 +5,7 @@ import { CreatedBySubject } from "./CreatedBySubject.js";
5
5
  import { SessionAgent } from "./SessionAgent.js";
6
6
  import { SessionMetadata } from "./SessionMetadata.js";
7
7
  import { SessionMetrics } from "./SessionMetrics.js";
8
+ import { SessionSource } from "./SessionSource.js";
8
9
  export declare const Session: core.serialization.ObjectSchema<serializers.Session.Raw, TrueForge.Session>;
9
10
  export declare namespace Session {
10
11
  interface Raw {
@@ -14,6 +15,7 @@ export declare namespace Session {
14
15
  id: string;
15
16
  metadata: SessionMetadata.Raw;
16
17
  metrics: SessionMetrics.Raw;
18
+ source?: SessionSource.Raw | null;
17
19
  title?: string | null;
18
20
  updated_at: string;
19
21
  }
@@ -40,6 +40,7 @@ const CreatedBySubject_js_1 = require("./CreatedBySubject.js");
40
40
  const SessionAgent_js_1 = require("./SessionAgent.js");
41
41
  const SessionMetadata_js_1 = require("./SessionMetadata.js");
42
42
  const SessionMetrics_js_1 = require("./SessionMetrics.js");
43
+ const SessionSource_js_1 = require("./SessionSource.js");
43
44
  exports.Session = core.serialization.object({
44
45
  agent: SessionAgent_js_1.SessionAgent,
45
46
  createdAt: core.serialization.property("created_at", core.serialization.string()),
@@ -47,6 +48,7 @@ exports.Session = core.serialization.object({
47
48
  id: core.serialization.string(),
48
49
  metadata: SessionMetadata_js_1.SessionMetadata,
49
50
  metrics: SessionMetrics_js_1.SessionMetrics,
51
+ source: SessionSource_js_1.SessionSource.nullable(),
50
52
  title: core.serialization.string().nullable(),
51
53
  updatedAt: core.serialization.property("updated_at", core.serialization.string()),
52
54
  });
@@ -4,7 +4,7 @@ import type * as serializers from "../index.js";
4
4
  export declare const SessionMetrics: core.serialization.ObjectSchema<serializers.SessionMetrics.Raw, TrueForge.SessionMetrics>;
5
5
  export declare namespace SessionMetrics {
6
6
  interface Raw {
7
- total_cost_in_usd: number;
7
+ total_cost_in_usd?: number | null;
8
8
  total_duration_ms: number;
9
9
  total_turns: number;
10
10
  }
@@ -37,7 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.SessionMetrics = void 0;
38
38
  const core = __importStar(require("../../core/index.js"));
39
39
  exports.SessionMetrics = core.serialization.object({
40
- totalCostInUsd: core.serialization.property("total_cost_in_usd", core.serialization.number()),
40
+ totalCostInUsd: core.serialization.property("total_cost_in_usd", core.serialization.number().optional()),
41
41
  totalDurationMs: core.serialization.property("total_duration_ms", core.serialization.number()),
42
42
  totalTurns: core.serialization.property("total_turns", core.serialization.number()),
43
43
  });
@@ -0,0 +1,11 @@
1
+ import type * as TrueForge from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ export declare const SessionSource: core.serialization.ObjectSchema<serializers.SessionSource.Raw, TrueForge.SessionSource>;
5
+ export declare namespace SessionSource {
6
+ interface Raw {
7
+ id: string;
8
+ run_id: string;
9
+ type: "schedule";
10
+ }
11
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.SessionSource = void 0;
38
+ const core = __importStar(require("../../core/index.js"));
39
+ exports.SessionSource = core.serialization.object({
40
+ id: core.serialization.string(),
41
+ runId: core.serialization.property("run_id", core.serialization.string()),
42
+ type: core.serialization.stringLiteral("schedule"),
43
+ });
@@ -0,0 +1,11 @@
1
+ import type * as TrueForge from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ export declare const SessionSourceSchedule: core.serialization.ObjectSchema<serializers.SessionSourceSchedule.Raw, TrueForge.SessionSourceSchedule>;
5
+ export declare namespace SessionSourceSchedule {
6
+ interface Raw {
7
+ id: string;
8
+ run_id: string;
9
+ type: "schedule";
10
+ }
11
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.SessionSourceSchedule = void 0;
38
+ const core = __importStar(require("../../core/index.js"));
39
+ exports.SessionSourceSchedule = core.serialization.object({
40
+ id: core.serialization.string(),
41
+ runId: core.serialization.property("run_id", core.serialization.string()),
42
+ type: core.serialization.stringLiteral("schedule"),
43
+ });
@@ -0,0 +1,7 @@
1
+ import type * as TrueForge from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ export declare const SessionSourceType: core.serialization.Schema<serializers.SessionSourceType.Raw, TrueForge.SessionSourceType>;
5
+ export declare namespace SessionSourceType {
6
+ type Raw = "schedule";
7
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.SessionSourceType = void 0;
38
+ const core = __importStar(require("../../core/index.js"));
39
+ exports.SessionSourceType = core.serialization.stringLiteral("schedule");
@@ -172,6 +172,9 @@ export * from "./SessionMetricsMeter.js";
172
172
  export * from "./SessionMetricsMeterName.js";
173
173
  export * from "./SessionMetricsMeterResponse.js";
174
174
  export * from "./SessionMetricsPoint.js";
175
+ export * from "./SessionSource.js";
176
+ export * from "./SessionSourceSchedule.js";
177
+ export * from "./SessionSourceType.js";
175
178
  export * from "./SettingsCapability.js";
176
179
  export * from "./Skill.js";
177
180
  export * from "./SkillCapability.js";
@@ -188,6 +188,9 @@ __exportStar(require("./SessionMetricsMeter.js"), exports);
188
188
  __exportStar(require("./SessionMetricsMeterName.js"), exports);
189
189
  __exportStar(require("./SessionMetricsMeterResponse.js"), exports);
190
190
  __exportStar(require("./SessionMetricsPoint.js"), exports);
191
+ __exportStar(require("./SessionSource.js"), exports);
192
+ __exportStar(require("./SessionSourceSchedule.js"), exports);
193
+ __exportStar(require("./SessionSourceType.js"), exports);
191
194
  __exportStar(require("./SettingsCapability.js"), exports);
192
195
  __exportStar(require("./Skill.js"), exports);
193
196
  __exportStar(require("./SkillCapability.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.4-rc.1";
1
+ export declare const SDK_VERSION = "0.1.4-rc.2";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.1.4-rc.1";
4
+ exports.SDK_VERSION = "0.1.4-rc.2";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@truefoundry/trueforge-sdk",
9
- "X-Fern-SDK-Version": "0.1.4-rc.1",
10
- "User-Agent": "@truefoundry/trueforge-sdk/0.1.4-rc.1",
9
+ "X-Fern-SDK-Version": "0.1.4-rc.2",
10
+ "User-Agent": "@truefoundry/trueforge-sdk/0.1.4-rc.2",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -12,4 +12,5 @@ export interface GetOrCreateSessionByExternalIdRequest {
12
12
  agent: TrueForge.CreateSessionAgent;
13
13
  /** Caller-supplied id unique within the tenant. */
14
14
  externalId: string;
15
+ source?: TrueForge.SessionSourceSchedule;
15
16
  }
@@ -11,7 +11,7 @@ export declare class SessionsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<SessionsClient.Options>;
12
12
  constructor(options: SessionsClient.Options);
13
13
  /**
14
- * List the caller's sessions (newest first by default).
14
+ * List the sessions (newest first by default).
15
15
  *
16
16
  * @param {TrueForge.ListSessionsRequest} request
17
17
  * @param {SessionsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -21,7 +21,7 @@ export class SessionsClient {
21
21
  this._options = normalizeClientOptionsWithAuth(options);
22
22
  }
23
23
  /**
24
- * List the caller's sessions (newest first by default).
24
+ * List the sessions (newest first by default).
25
25
  *
26
26
  * @param {TrueForge.ListSessionsRequest} request
27
27
  * @param {SessionsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -37,7 +37,7 @@ export class SessionsClient {
37
37
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
38
38
  const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
39
39
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
40
- const { limit = 25, order, pageToken, startTimestamp, endTimestamp, agentId, createdByMe } = request;
40
+ const { limit = 25, order, pageToken, startTimestamp, endTimestamp, agentId, createdByMe, metadata, sourceType, sourceId, } = request;
41
41
  const _queryParams = {
42
42
  limit,
43
43
  order: order != null
@@ -53,6 +53,16 @@ export class SessionsClient {
53
53
  end_timestamp: endTimestamp != null ? endTimestamp === null || endTimestamp === void 0 ? void 0 : endTimestamp.toISOString() : undefined,
54
54
  agent_id: agentId,
55
55
  created_by_me: createdByMe,
56
+ metadata,
57
+ source_type: sourceType != null
58
+ ? serializers.SessionSourceType.jsonOrThrow(sourceType, {
59
+ unrecognizedObjectKeys: "passthrough",
60
+ allowUnrecognizedUnionMembers: true,
61
+ allowUnrecognizedEnumValues: true,
62
+ omitUndefined: true,
63
+ })
64
+ : undefined,
65
+ source_id: sourceId,
56
66
  };
57
67
  const _authRequest = yield this._options.authProvider.getAuthRequest();
58
68
  const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -18,4 +18,10 @@ export interface ListSessionsRequest {
18
18
  agentId?: string;
19
19
  /** When true, only sessions created by the authenticated subject. */
20
20
  createdByMe?: boolean;
21
+ /** Exact metadata pairs as metadata[key]=value. Sessions must contain all pairs. */
22
+ metadata?: TrueForge.SessionMetadata;
23
+ /** When set, returns only sessions created by this source type. */
24
+ sourceType?: TrueForge.SessionSourceType;
25
+ /** When set, returns only sessions from this specific source. Requires source_type. */
26
+ sourceId?: string;
21
27
  }
@@ -8,6 +8,7 @@ export interface Session {
8
8
  id: string;
9
9
  metadata: TrueForge.SessionMetadata;
10
10
  metrics: TrueForge.SessionMetrics;
11
+ source: TrueForge.SessionSource | null;
11
12
  /** Optional human-readable title; null until set. */
12
13
  title: string | null;
13
14
  /** ISO 8601 last-update timestamp. */
@@ -2,7 +2,8 @@
2
2
  * Rolled-up cost, duration, and turn counters for a session.
3
3
  */
4
4
  export interface SessionMetrics {
5
- totalCostInUsd: number;
5
+ /** Estimated total cost in USD for this session */
6
+ totalCostInUsd?: number;
6
7
  totalDurationMs: number;
7
8
  totalTurns: number;
8
9
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * How this session was created (e.g. a schedule run). Null for interactive sessions.
3
+ */
4
+ export interface SessionSource {
5
+ /** Schedule id. */
6
+ id: string;
7
+ /** Schedule run id. */
8
+ runId: string;
9
+ /** Session was created by a schedule run. */
10
+ type: "schedule";
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface SessionSourceSchedule {
2
+ /** Schedule id. */
3
+ id: string;
4
+ /** Schedule run id. */
5
+ runId: string;
6
+ /** Session was created by a schedule run. */
7
+ type: "schedule";
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * When set, returns only sessions created by this source type.
3
+ */
4
+ export type SessionSourceType = "schedule";
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -172,6 +172,9 @@ export * from "./SessionMetricsMeter.mjs";
172
172
  export * from "./SessionMetricsMeterName.mjs";
173
173
  export * from "./SessionMetricsMeterResponse.mjs";
174
174
  export * from "./SessionMetricsPoint.mjs";
175
+ export * from "./SessionSource.mjs";
176
+ export * from "./SessionSourceSchedule.mjs";
177
+ export * from "./SessionSourceType.mjs";
175
178
  export * from "./SettingsCapability.mjs";
176
179
  export * from "./Skill.mjs";
177
180
  export * from "./SkillCapability.mjs";
@@ -172,6 +172,9 @@ export * from "./SessionMetricsMeter.mjs";
172
172
  export * from "./SessionMetricsMeterName.mjs";
173
173
  export * from "./SessionMetricsMeterResponse.mjs";
174
174
  export * from "./SessionMetricsPoint.mjs";
175
+ export * from "./SessionSource.mjs";
176
+ export * from "./SessionSourceSchedule.mjs";
177
+ export * from "./SessionSourceType.mjs";
175
178
  export * from "./SettingsCapability.mjs";
176
179
  export * from "./Skill.mjs";
177
180
  export * from "./SkillCapability.mjs";
@@ -2,10 +2,12 @@ import type * as TrueForge from "../../../../../../../api/index.mjs";
2
2
  import * as core from "../../../../../../../core/index.mjs";
3
3
  import type * as serializers from "../../../../../../index.mjs";
4
4
  import { CreateSessionAgent } from "../../../../../../types/CreateSessionAgent.mjs";
5
+ import { SessionSourceSchedule } from "../../../../../../types/SessionSourceSchedule.mjs";
5
6
  export declare const GetOrCreateSessionByExternalIdRequest: core.serialization.Schema<serializers.internal.GetOrCreateSessionByExternalIdRequest.Raw, TrueForge.internal.GetOrCreateSessionByExternalIdRequest>;
6
7
  export declare namespace GetOrCreateSessionByExternalIdRequest {
7
8
  interface Raw {
8
9
  agent: CreateSessionAgent.Raw;
9
10
  external_id: string;
11
+ source?: SessionSourceSchedule.Raw | null;
10
12
  }
11
13
  }
@@ -1,7 +1,9 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  import * as core from "../../../../../../../core/index.mjs";
3
3
  import { CreateSessionAgent } from "../../../../../../types/CreateSessionAgent.mjs";
4
+ import { SessionSourceSchedule } from "../../../../../../types/SessionSourceSchedule.mjs";
4
5
  export const GetOrCreateSessionByExternalIdRequest = core.serialization.object({
5
6
  agent: CreateSessionAgent,
6
7
  externalId: core.serialization.property("external_id", core.serialization.string()),
8
+ source: SessionSourceSchedule.optional(),
7
9
  });
@@ -5,6 +5,7 @@ import { CreatedBySubject } from "./CreatedBySubject.mjs";
5
5
  import { SessionAgent } from "./SessionAgent.mjs";
6
6
  import { SessionMetadata } from "./SessionMetadata.mjs";
7
7
  import { SessionMetrics } from "./SessionMetrics.mjs";
8
+ import { SessionSource } from "./SessionSource.mjs";
8
9
  export declare const Session: core.serialization.ObjectSchema<serializers.Session.Raw, TrueForge.Session>;
9
10
  export declare namespace Session {
10
11
  interface Raw {
@@ -14,6 +15,7 @@ export declare namespace Session {
14
15
  id: string;
15
16
  metadata: SessionMetadata.Raw;
16
17
  metrics: SessionMetrics.Raw;
18
+ source?: SessionSource.Raw | null;
17
19
  title?: string | null;
18
20
  updated_at: string;
19
21
  }
@@ -4,6 +4,7 @@ import { CreatedBySubject } from "./CreatedBySubject.mjs";
4
4
  import { SessionAgent } from "./SessionAgent.mjs";
5
5
  import { SessionMetadata } from "./SessionMetadata.mjs";
6
6
  import { SessionMetrics } from "./SessionMetrics.mjs";
7
+ import { SessionSource } from "./SessionSource.mjs";
7
8
  export const Session = core.serialization.object({
8
9
  agent: SessionAgent,
9
10
  createdAt: core.serialization.property("created_at", core.serialization.string()),
@@ -11,6 +12,7 @@ export const Session = core.serialization.object({
11
12
  id: core.serialization.string(),
12
13
  metadata: SessionMetadata,
13
14
  metrics: SessionMetrics,
15
+ source: SessionSource.nullable(),
14
16
  title: core.serialization.string().nullable(),
15
17
  updatedAt: core.serialization.property("updated_at", core.serialization.string()),
16
18
  });
@@ -4,7 +4,7 @@ import type * as serializers from "../index.mjs";
4
4
  export declare const SessionMetrics: core.serialization.ObjectSchema<serializers.SessionMetrics.Raw, TrueForge.SessionMetrics>;
5
5
  export declare namespace SessionMetrics {
6
6
  interface Raw {
7
- total_cost_in_usd: number;
7
+ total_cost_in_usd?: number | null;
8
8
  total_duration_ms: number;
9
9
  total_turns: number;
10
10
  }
@@ -1,7 +1,7 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  import * as core from "../../core/index.mjs";
3
3
  export const SessionMetrics = core.serialization.object({
4
- totalCostInUsd: core.serialization.property("total_cost_in_usd", core.serialization.number()),
4
+ totalCostInUsd: core.serialization.property("total_cost_in_usd", core.serialization.number().optional()),
5
5
  totalDurationMs: core.serialization.property("total_duration_ms", core.serialization.number()),
6
6
  totalTurns: core.serialization.property("total_turns", core.serialization.number()),
7
7
  });
@@ -0,0 +1,11 @@
1
+ import type * as TrueForge from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import type * as serializers from "../index.mjs";
4
+ export declare const SessionSource: core.serialization.ObjectSchema<serializers.SessionSource.Raw, TrueForge.SessionSource>;
5
+ export declare namespace SessionSource {
6
+ interface Raw {
7
+ id: string;
8
+ run_id: string;
9
+ type: "schedule";
10
+ }
11
+ }
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ export const SessionSource = core.serialization.object({
4
+ id: core.serialization.string(),
5
+ runId: core.serialization.property("run_id", core.serialization.string()),
6
+ type: core.serialization.stringLiteral("schedule"),
7
+ });
@@ -0,0 +1,11 @@
1
+ import type * as TrueForge from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import type * as serializers from "../index.mjs";
4
+ export declare const SessionSourceSchedule: core.serialization.ObjectSchema<serializers.SessionSourceSchedule.Raw, TrueForge.SessionSourceSchedule>;
5
+ export declare namespace SessionSourceSchedule {
6
+ interface Raw {
7
+ id: string;
8
+ run_id: string;
9
+ type: "schedule";
10
+ }
11
+ }
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ export const SessionSourceSchedule = core.serialization.object({
4
+ id: core.serialization.string(),
5
+ runId: core.serialization.property("run_id", core.serialization.string()),
6
+ type: core.serialization.stringLiteral("schedule"),
7
+ });
@@ -0,0 +1,7 @@
1
+ import type * as TrueForge from "../../api/index.mjs";
2
+ import * as core from "../../core/index.mjs";
3
+ import type * as serializers from "../index.mjs";
4
+ export declare const SessionSourceType: core.serialization.Schema<serializers.SessionSourceType.Raw, TrueForge.SessionSourceType>;
5
+ export declare namespace SessionSourceType {
6
+ type Raw = "schedule";
7
+ }
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../core/index.mjs";
3
+ export const SessionSourceType = core.serialization.stringLiteral("schedule");
@@ -172,6 +172,9 @@ export * from "./SessionMetricsMeter.mjs";
172
172
  export * from "./SessionMetricsMeterName.mjs";
173
173
  export * from "./SessionMetricsMeterResponse.mjs";
174
174
  export * from "./SessionMetricsPoint.mjs";
175
+ export * from "./SessionSource.mjs";
176
+ export * from "./SessionSourceSchedule.mjs";
177
+ export * from "./SessionSourceType.mjs";
175
178
  export * from "./SettingsCapability.mjs";
176
179
  export * from "./Skill.mjs";
177
180
  export * from "./SkillCapability.mjs";
@@ -172,6 +172,9 @@ export * from "./SessionMetricsMeter.mjs";
172
172
  export * from "./SessionMetricsMeterName.mjs";
173
173
  export * from "./SessionMetricsMeterResponse.mjs";
174
174
  export * from "./SessionMetricsPoint.mjs";
175
+ export * from "./SessionSource.mjs";
176
+ export * from "./SessionSourceSchedule.mjs";
177
+ export * from "./SessionSourceType.mjs";
175
178
  export * from "./SettingsCapability.mjs";
176
179
  export * from "./Skill.mjs";
177
180
  export * from "./SkillCapability.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.4-rc.1";
1
+ export declare const SDK_VERSION = "0.1.4-rc.2";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.1.4-rc.1";
1
+ export const SDK_VERSION = "0.1.4-rc.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truefoundry/trueforge-sdk",
3
- "version": "0.1.4-rc.1",
3
+ "version": "0.1.4-rc.2",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "main": "./dist/cjs/index.js",
package/reference.md CHANGED
@@ -1235,7 +1235,7 @@ await client.schedules.listRuns("schedule_id");
1235
1235
  <dl>
1236
1236
  <dd>
1237
1237
 
1238
- List the caller's sessions (newest first by default).
1238
+ List the sessions (newest first by default).
1239
1239
  </dd>
1240
1240
  </dl>
1241
1241
  </dd>