@narrative.io/data-collaboration-sdk-ts 2.107.0 → 2.108.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.
@@ -126,6 +126,33 @@ export interface RunError {
126
126
  title?: string;
127
127
  docs_url?: string;
128
128
  }
129
+ /**
130
+ * A turn the agent loop has produced during an active run but has not yet
131
+ * committed to the conversation's message log. The loop appends one of these
132
+ * per produced turn (assistant `tool_use`, tool `tool_result`, ...) to
133
+ * `agent_run_live_messages`, ordered by `turn_index`. Surfaced on
134
+ * `RunResponse.live.messages` only while the run is non-terminal; finalize
135
+ * clears them and re-writes the same content as committed messages with
136
+ * gap-free `sequence_no`.
137
+ *
138
+ * Order by `turn_index` (run-local), not `sequence_no` — live turns do not
139
+ * carry `sequence_no` and never collide with the committed table.
140
+ */
141
+ export interface LiveRunTurn {
142
+ turn_index: number;
143
+ role: AgentMessageRole;
144
+ content_blocks: ContentBlock[];
145
+ created_at: string;
146
+ }
147
+ /**
148
+ * In-flight progress for a non-terminal run. Empty (or omitted) once the run
149
+ * reaches a terminal state — at that point the same content is available on
150
+ * `GET /agents/conversations/{id}/messages?since={version}` as committed
151
+ * turns with `sequence_no`.
152
+ */
153
+ export interface RunLiveProgress {
154
+ messages: LiveRunTurn[];
155
+ }
129
156
  export interface RunResponse {
130
157
  id: RunId;
131
158
  conversation_id: ConversationId;
@@ -143,6 +170,13 @@ export interface RunResponse {
143
170
  error?: RunError | null;
144
171
  started_at: string;
145
172
  completed_at?: string | null;
173
+ /**
174
+ * In-flight tool-loop progress while the run is non-terminal. Empty
175
+ * (or absent) after finalize; consumers must then fall back to
176
+ * `listAgentConversationMessages({ since: version-at-run-start })` for
177
+ * the committed turns.
178
+ */
179
+ live?: RunLiveProgress | null;
146
180
  }
147
181
  export type AgentMessageRole = "user" | "assistant" | "tool";
148
182
  export interface TextContentBlock {
@@ -0,0 +1,20 @@
1
+ import { BaseApi } from "../base-api";
2
+ import type { ApiRecords } from "../types";
3
+ import type { CompanyAdminResponse } from "./types";
4
+ export * from "./types";
5
+ /**
6
+ * @module CompaniesApi
7
+ * @description Admin Companies: list and inspect companies on the platform.
8
+ * Requires the `admin:company_info` permission. Archived companies are
9
+ * excluded server-side from the list.
10
+ *
11
+ * @extends BaseApi
12
+ */
13
+ export declare class CompaniesApi extends BaseApi {
14
+ /**
15
+ * List all active and pending companies, newest filter applied server-side
16
+ * (archived excluded). Returns the `records` envelope only — no pagination
17
+ * metadata is provided by the backend for this endpoint.
18
+ */
19
+ getCompanies(): Promise<ApiRecords<CompanyAdminResponse>>;
20
+ }
@@ -0,0 +1,21 @@
1
+ import { BaseApi } from "../base-api";
2
+ export * from "./types";
3
+ const resourceName = "admin/companies";
4
+ /**
5
+ * @module CompaniesApi
6
+ * @description Admin Companies: list and inspect companies on the platform.
7
+ * Requires the `admin:company_info` permission. Archived companies are
8
+ * excluded server-side from the list.
9
+ *
10
+ * @extends BaseApi
11
+ */
12
+ export class CompaniesApi extends BaseApi {
13
+ /**
14
+ * List all active and pending companies, newest filter applied server-side
15
+ * (archived excluded). Returns the `records` envelope only — no pagination
16
+ * metadata is provided by the backend for this endpoint.
17
+ */
18
+ async getCompanies() {
19
+ return await this.get(resourceName);
20
+ }
21
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Admin Companies API — types.
3
+ *
4
+ * Mirrors `/admin/companies` on the Narrative Data Collaboration Platform.
5
+ * Requires a bearer token with the `admin:company_info` permission.
6
+ */
7
+ export type CompanyStatus = "active" | "pending" | "archived";
8
+ export type CompanyVisibility = "visible" | "invisible" | "invisible-in-discover";
9
+ export interface CompanyAdminResponse {
10
+ id: number;
11
+ company_type: string | null;
12
+ contact: string | null;
13
+ created_at: string;
14
+ description_long: string | null;
15
+ description_short: string | null;
16
+ image_url: string | null;
17
+ location: string | null;
18
+ name: string;
19
+ size: string | null;
20
+ status: CompanyStatus;
21
+ updated_at: string | null;
22
+ visibility: CompanyVisibility;
23
+ website: string | null;
24
+ credit_limit_usd: number;
25
+ check_datashops_credit_limit: boolean;
26
+ slug: string | null;
27
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Admin Companies API — types.
3
+ *
4
+ * Mirrors `/admin/companies` on the Narrative Data Collaboration Platform.
5
+ * Requires a bearer token with the `admin:company_info` permission.
6
+ */
7
+ export {};
package/build/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./attributes";
7
7
  export * from "./authentication";
8
8
  export * from "./base-api";
9
9
  export * from "./collaboration-policy";
10
+ export * from "./companies";
10
11
  export * from "./company-info";
11
12
  export * from "./compute-pools";
12
13
  export * from "./compute-pools/types";
@@ -61,6 +62,7 @@ import { AppsApi } from "./apps";
61
62
  import { AttributeApi, AttributeApiV2 } from "./attributes";
62
63
  import { AuthenticationApi } from "./authentication";
63
64
  import { BaseApi } from "./base-api";
65
+ import { CompaniesApi } from "./companies";
64
66
  import { CompanyInfoApi } from "./company-info";
65
67
  import { ComputePoolsApi } from "./compute-pools";
66
68
  import { ConnectionsApi } from "./connections";
@@ -89,6 +91,6 @@ import { WhoAmIApi } from "./whoami";
89
91
  import { WorkflowsApi } from "./workflows";
90
92
  declare class NarrativeApi extends BaseApi {
91
93
  }
92
- interface NarrativeApi extends BaseApi, HealthCheckApi, AccessTokensApi, DataPlaneApi, DatasetApi, RosettaStoneApi, AttributeApi, AttributeApiV2, PingApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi, QueriesApi, ViewsApi, ModelsApi, ModelTrainingApi, ModelInferenceApi, EncryptionMaterialApi, WhoAmIApi, WorkflowsApi, ComputePoolsApi, AgentsApi {
94
+ interface NarrativeApi extends BaseApi, HealthCheckApi, AccessTokensApi, DataPlaneApi, DatasetApi, RosettaStoneApi, AttributeApi, AttributeApiV2, PingApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi, QueriesApi, ViewsApi, ModelsApi, ModelTrainingApi, ModelInferenceApi, EncryptionMaterialApi, WhoAmIApi, WorkflowsApi, ComputePoolsApi, AgentsApi, CompaniesApi {
93
95
  }
94
96
  export { NarrativeApi };
package/build/index.js CHANGED
@@ -7,6 +7,7 @@ export * from "./attributes";
7
7
  export * from "./authentication";
8
8
  export * from "./base-api";
9
9
  export * from "./collaboration-policy";
10
+ export * from "./companies";
10
11
  export * from "./company-info";
11
12
  export * from "./compute-pools";
12
13
  export * from "./compute-pools/types";
@@ -62,6 +63,7 @@ import { AttributeApi, AttributeApiV2 } from "./attributes";
62
63
  import { AuthenticationApi } from "./authentication";
63
64
  // Handle the NarrativeApi class with mixins
64
65
  import { BaseApi } from "./base-api";
66
+ import { CompaniesApi } from "./companies";
65
67
  import { CompanyInfoApi } from "./company-info";
66
68
  import { ComputePoolsApi } from "./compute-pools";
67
69
  import { ConnectionsApi } from "./connections";
@@ -126,5 +128,6 @@ applyMixins(NarrativeApi, [
126
128
  WorkflowsApi,
127
129
  ComputePoolsApi,
128
130
  AgentsApi,
131
+ CompaniesApi,
129
132
  ]);
130
133
  export { NarrativeApi };
@@ -1,6 +1,6 @@
1
1
  import { BaseApi } from "../base-api";
2
2
  import type { ApiRecords, ApiRecordsV2 } from "../types";
3
- import type { AppCategory, CreateInstallationRequest, Installation, InstallationInfo, Profile } from "./types";
3
+ import type { AppCategory, CreateInstallationRequest, Installation, InstallationAccessToken, InstallationInfo, Profile } from "./types";
4
4
  export interface ListInstallationsOptions {
5
5
  appCategory?: AppCategory | AppCategory[];
6
6
  page?: number;
@@ -33,5 +33,12 @@ declare class InstallationsApi extends BaseApi {
33
33
  */
34
34
  deleteInstallation(installationId: number): Promise<void>;
35
35
  getInstallationProfiles(installationId: number): Promise<ApiRecords<Profile>>;
36
+ /**
37
+ * Create an installation-scoped access token on behalf of the authenticated
38
+ * user. Requires a user-bound bearer token (app client-credentials tokens
39
+ * return 403). 404 if the installation does not exist or does not belong to
40
+ * the caller's company.
41
+ */
42
+ createInstallationToken(installationId: number): Promise<InstallationAccessToken>;
36
43
  }
37
- export { type AppCategory, type CreateInstallationRequest, type Installation, type InstallationInfo, InstallationsApi, type Profile, };
44
+ export { type AppCategory, type CreateInstallationRequest, type Installation, type InstallationAccessToken, type InstallationInfo, InstallationsApi, type Profile, };
@@ -45,5 +45,14 @@ class InstallationsApi extends BaseApi {
45
45
  const url = `${resourceName}/${installationId}/profiles`;
46
46
  return await this.get(url);
47
47
  }
48
+ /**
49
+ * Create an installation-scoped access token on behalf of the authenticated
50
+ * user. Requires a user-bound bearer token (app client-credentials tokens
51
+ * return 403). 404 if the installation does not exist or does not belong to
52
+ * the caller's company.
53
+ */
54
+ async createInstallationToken(installationId) {
55
+ return await this.post(`${resourceName}/${installationId}/token`);
56
+ }
48
57
  }
49
58
  export { InstallationsApi, };
@@ -26,3 +26,9 @@ export interface Profile {
26
26
  description: string;
27
27
  status: ProfileStatus;
28
28
  }
29
+ export interface InstallationAccessToken {
30
+ access_token: string;
31
+ access_token_expires_in: number;
32
+ refresh_token: string;
33
+ refresh_token_expires_in: number;
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "2.107.0",
3
+ "version": "2.108.0",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",
@@ -29,19 +29,19 @@
29
29
  "@babel/preset-env": "7.29.7",
30
30
  "@babel/preset-typescript": "7.29.7",
31
31
  "@biomejs/biome": "2.4.16",
32
- "@commitlint/cli": "21.0.1",
33
- "@commitlint/config-conventional": "21.0.1",
32
+ "@commitlint/cli": "21.0.2",
33
+ "@commitlint/config-conventional": "21.0.2",
34
34
  "@types/jest": "30.0.0",
35
35
  "@types/json-schema": "7.0.15",
36
36
  "babel-jest": "30.4.1",
37
37
  "jest": "30.4.2",
38
- "lefthook": "2.1.8",
38
+ "lefthook": "2.1.9",
39
39
  "ts-jest": "29.4.11"
40
40
  },
41
41
  "dependencies": {
42
42
  "mande": "2.0.9",
43
43
  "zod": "4.4.3",
44
- "bignumber.js": "11.1.1"
44
+ "bignumber.js": "11.1.2"
45
45
  },
46
46
  "overrides": {
47
47
  "semver@<7.5.2": "7.5.2"