@copilotkit/shared 1.61.0 → 1.61.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.
@@ -3,7 +3,7 @@ import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, Existenc
3
3
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./console-styling.cjs";
4
4
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./errors.cjs";
5
5
  import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./json-schema.cjs";
6
- import { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode } from "./types.cjs";
6
+ import { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, ThreadEndpointRuntimeInfo } from "./types.cjs";
7
7
  import { dataToUUID, isValidUUID, randomId, randomUUID } from "./random-id.cjs";
8
8
  import { readBody } from "./requests.cjs";
9
9
 
@@ -3,7 +3,7 @@ import { BaseCondition, ComparisonCondition, ComparisonRule, Condition, Existenc
3
3
  import { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole } from "./console-styling.mjs";
4
4
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, getPossibleVersionMismatch, isStructuredCopilotKitError } from "./errors.mjs";
5
5
  import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./json-schema.mjs";
6
- import { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode } from "./types.mjs";
6
+ import { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, ThreadEndpointRuntimeInfo } from "./types.mjs";
7
7
  import { dataToUUID, isValidUUID, randomId, randomUUID } from "./random-id.mjs";
8
8
  import { readBody } from "./requests.mjs";
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\n/**\n * More specific utility for records with at least one key\n */\nexport type NonEmptyRecord<T> =\n T extends Record<string, unknown>\n ? keyof T extends never\n ? never\n : T\n : never;\n\n/**\n * Type representing an agent's basic information\n */\nexport interface AgentDescription {\n name: string;\n className: string;\n description: string;\n capabilities?: AgentCapabilities;\n}\n\nexport type RuntimeMode = \"sse\" | \"intelligence\";\n\nexport const RUNTIME_MODE_SSE = \"sse\" as const;\nexport const RUNTIME_MODE_INTELLIGENCE = \"intelligence\" as const;\n\nexport interface IntelligenceRuntimeInfo {\n wsUrl: string;\n}\n\nexport type RuntimeLicenseStatus =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n\nexport interface A2UIRuntimeInfo {\n enabled: boolean;\n /**\n * Agent ids the runtime applies A2UI to. When omitted, A2UI applies to\n * every agent served by the runtime.\n */\n agents?: string[];\n}\n\nexport interface RuntimeInfo {\n version: string;\n agents: Record<string, AgentDescription>;\n audioFileTranscriptionEnabled: boolean;\n mode: RuntimeMode;\n intelligence?: IntelligenceRuntimeInfo;\n /**\n * @deprecated Use `a2ui` instead, which preserves per-agent scoping.\n * Kept for backward compatibility with older clients.\n */\n a2uiEnabled?: boolean;\n a2ui?: A2UIRuntimeInfo;\n openGenerativeUIEnabled?: boolean;\n licenseStatus?: RuntimeLicenseStatus;\n telemetryDisabled?: boolean;\n}\n"],"mappings":";;AA0BA,MAAa,mBAAmB;AAChC,MAAa,4BAA4B"}
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\n/**\n * More specific utility for records with at least one key\n */\nexport type NonEmptyRecord<T> =\n T extends Record<string, unknown>\n ? keyof T extends never\n ? never\n : T\n : never;\n\n/**\n * Type representing an agent's basic information\n */\nexport interface AgentDescription {\n name: string;\n className: string;\n description: string;\n capabilities?: AgentCapabilities;\n}\n\nexport type RuntimeMode = \"sse\" | \"intelligence\";\n\nexport const RUNTIME_MODE_SSE = \"sse\" as const;\nexport const RUNTIME_MODE_INTELLIGENCE = \"intelligence\" as const;\n\nexport interface IntelligenceRuntimeInfo {\n wsUrl: string;\n}\n\nexport interface ThreadEndpointRuntimeInfo {\n list: boolean;\n inspect: boolean;\n mutations: boolean;\n realtimeMetadata: boolean;\n}\n\nexport type RuntimeLicenseStatus =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n\nexport interface A2UIRuntimeInfo {\n enabled: boolean;\n /**\n * Agent ids the runtime applies A2UI to. When omitted, A2UI applies to\n * every agent served by the runtime.\n */\n agents?: string[];\n}\n\nexport interface RuntimeInfo {\n version: string;\n agents: Record<string, AgentDescription>;\n audioFileTranscriptionEnabled: boolean;\n mode: RuntimeMode;\n intelligence?: IntelligenceRuntimeInfo;\n threadEndpoints?: ThreadEndpointRuntimeInfo;\n /**\n * @deprecated Use `a2ui` instead, which preserves per-agent scoping.\n * Kept for backward compatibility with older clients.\n */\n a2uiEnabled?: boolean;\n a2ui?: A2UIRuntimeInfo;\n openGenerativeUIEnabled?: boolean;\n licenseStatus?: RuntimeLicenseStatus;\n telemetryDisabled?: boolean;\n}\n"],"mappings":";;AA0BA,MAAa,mBAAmB;AAChC,MAAa,4BAA4B"}
@@ -21,6 +21,12 @@ declare const RUNTIME_MODE_INTELLIGENCE: "intelligence";
21
21
  interface IntelligenceRuntimeInfo {
22
22
  wsUrl: string;
23
23
  }
24
+ interface ThreadEndpointRuntimeInfo {
25
+ list: boolean;
26
+ inspect: boolean;
27
+ mutations: boolean;
28
+ realtimeMetadata: boolean;
29
+ }
24
30
  type RuntimeLicenseStatus = "valid" | "none" | "expired" | "expiring" | "invalid" | "unknown";
25
31
  interface A2UIRuntimeInfo {
26
32
  enabled: boolean;
@@ -36,6 +42,7 @@ interface RuntimeInfo {
36
42
  audioFileTranscriptionEnabled: boolean;
37
43
  mode: RuntimeMode;
38
44
  intelligence?: IntelligenceRuntimeInfo;
45
+ threadEndpoints?: ThreadEndpointRuntimeInfo;
39
46
  /**
40
47
  * @deprecated Use `a2ui` instead, which preserves per-agent scoping.
41
48
  * Kept for backward compatibility with older clients.
@@ -47,5 +54,5 @@ interface RuntimeInfo {
47
54
  telemetryDisabled?: boolean;
48
55
  }
49
56
  //#endregion
50
- export { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode };
57
+ export { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, ThreadEndpointRuntimeInfo };
51
58
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/utils/types.ts"],"mappings":";;;KAEY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;;AAA9C;;KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,GAAe,iBAAA;AAAA;AAAA,KAGL,WAAA;AAAA,cAEC,gBAAA;AAAA,cACA,yBAAA;AAAA,UAEI,uBAAA;EACf,KAAA;AAAA;AAAA,KAGU,oBAAA;AAAA,UAQK,eAAA;EACf,OAAA;EA/BO;;;;EAoCP,MAAA;AAAA;AAAA,UAGe,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;EACA,IAAA,EAAM,WAAA;EACN,YAAA,GAAe,uBAAA;EAlCiB;;;;EAuChC,WAAA;EACA,IAAA,GAAO,eAAA;EACP,uBAAA;EACA,aAAA,GAAgB,oBAAA;EAChB,iBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/utils/types.ts"],"mappings":";;;KAEY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;;AAA9C;;KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,GAAe,iBAAA;AAAA;AAAA,KAGL,WAAA;AAAA,cAEC,gBAAA;AAAA,cACA,yBAAA;AAAA,UAEI,uBAAA;EACf,KAAA;AAAA;AAAA,UAGe,yBAAA;EACf,IAAA;EACA,OAAA;EACA,SAAA;EACA,gBAAA;AAAA;AAAA,KAGU,oBAAA;AAAA,UAQK,eAAA;EACf,OAAA;EAtCM;;;AAMR;EAqCE,MAAA;AAAA;AAAA,UAGe,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;EACA,IAAA,EAAM,WAAA;EACN,YAAA,GAAe,uBAAA;EACf,eAAA,GAAkB,yBAAA;EA1Cc;AAGlC;;;EA4CE,WAAA;EACA,IAAA,GAAO,eAAA;EACP,uBAAA;EACA,aAAA,GAAgB,oBAAA;EAChB,iBAAA;AAAA"}
@@ -21,6 +21,12 @@ declare const RUNTIME_MODE_INTELLIGENCE: "intelligence";
21
21
  interface IntelligenceRuntimeInfo {
22
22
  wsUrl: string;
23
23
  }
24
+ interface ThreadEndpointRuntimeInfo {
25
+ list: boolean;
26
+ inspect: boolean;
27
+ mutations: boolean;
28
+ realtimeMetadata: boolean;
29
+ }
24
30
  type RuntimeLicenseStatus = "valid" | "none" | "expired" | "expiring" | "invalid" | "unknown";
25
31
  interface A2UIRuntimeInfo {
26
32
  enabled: boolean;
@@ -36,6 +42,7 @@ interface RuntimeInfo {
36
42
  audioFileTranscriptionEnabled: boolean;
37
43
  mode: RuntimeMode;
38
44
  intelligence?: IntelligenceRuntimeInfo;
45
+ threadEndpoints?: ThreadEndpointRuntimeInfo;
39
46
  /**
40
47
  * @deprecated Use `a2ui` instead, which preserves per-agent scoping.
41
48
  * Kept for backward compatibility with older clients.
@@ -47,5 +54,5 @@ interface RuntimeInfo {
47
54
  telemetryDisabled?: boolean;
48
55
  }
49
56
  //#endregion
50
- export { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode };
57
+ export { A2UIRuntimeInfo, AgentDescription, IntelligenceRuntimeInfo, MaybePromise, NonEmptyRecord, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, ThreadEndpointRuntimeInfo };
51
58
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/utils/types.ts"],"mappings":";;;KAEY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;;AAA9C;;KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,GAAe,iBAAA;AAAA;AAAA,KAGL,WAAA;AAAA,cAEC,gBAAA;AAAA,cACA,yBAAA;AAAA,UAEI,uBAAA;EACf,KAAA;AAAA;AAAA,KAGU,oBAAA;AAAA,UAQK,eAAA;EACf,OAAA;EA/BO;;;;EAoCP,MAAA;AAAA;AAAA,UAGe,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;EACA,IAAA,EAAM,WAAA;EACN,YAAA,GAAe,uBAAA;EAlCiB;;;;EAuChC,WAAA;EACA,IAAA,GAAO,eAAA;EACP,uBAAA;EACA,aAAA,GAAgB,oBAAA;EAChB,iBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/utils/types.ts"],"mappings":";;;KAEY,YAAA,MAAkB,CAAA,GAAI,WAAA,CAAY,CAAA;;AAA9C;;KAKY,cAAA,MACV,CAAA,SAAU,MAAA,0BACA,CAAA,yBAEJ,CAAA;;;;UAMS,gBAAA;EACf,IAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,GAAe,iBAAA;AAAA;AAAA,KAGL,WAAA;AAAA,cAEC,gBAAA;AAAA,cACA,yBAAA;AAAA,UAEI,uBAAA;EACf,KAAA;AAAA;AAAA,UAGe,yBAAA;EACf,IAAA;EACA,OAAA;EACA,SAAA;EACA,gBAAA;AAAA;AAAA,KAGU,oBAAA;AAAA,UAQK,eAAA;EACf,OAAA;EAtCM;;;AAMR;EAqCE,MAAA;AAAA;AAAA,UAGe,WAAA;EACf,OAAA;EACA,MAAA,EAAQ,MAAA,SAAe,gBAAA;EACvB,6BAAA;EACA,IAAA,EAAM,WAAA;EACN,YAAA,GAAe,uBAAA;EACf,eAAA,GAAkB,yBAAA;EA1Cc;AAGlC;;;EA4CE,WAAA;EACA,IAAA,GAAO,eAAA;EACP,uBAAA;EACA,aAAA,GAAgB,oBAAA;EAChB,iBAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\n/**\n * More specific utility for records with at least one key\n */\nexport type NonEmptyRecord<T> =\n T extends Record<string, unknown>\n ? keyof T extends never\n ? never\n : T\n : never;\n\n/**\n * Type representing an agent's basic information\n */\nexport interface AgentDescription {\n name: string;\n className: string;\n description: string;\n capabilities?: AgentCapabilities;\n}\n\nexport type RuntimeMode = \"sse\" | \"intelligence\";\n\nexport const RUNTIME_MODE_SSE = \"sse\" as const;\nexport const RUNTIME_MODE_INTELLIGENCE = \"intelligence\" as const;\n\nexport interface IntelligenceRuntimeInfo {\n wsUrl: string;\n}\n\nexport type RuntimeLicenseStatus =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n\nexport interface A2UIRuntimeInfo {\n enabled: boolean;\n /**\n * Agent ids the runtime applies A2UI to. When omitted, A2UI applies to\n * every agent served by the runtime.\n */\n agents?: string[];\n}\n\nexport interface RuntimeInfo {\n version: string;\n agents: Record<string, AgentDescription>;\n audioFileTranscriptionEnabled: boolean;\n mode: RuntimeMode;\n intelligence?: IntelligenceRuntimeInfo;\n /**\n * @deprecated Use `a2ui` instead, which preserves per-agent scoping.\n * Kept for backward compatibility with older clients.\n */\n a2uiEnabled?: boolean;\n a2ui?: A2UIRuntimeInfo;\n openGenerativeUIEnabled?: boolean;\n licenseStatus?: RuntimeLicenseStatus;\n telemetryDisabled?: boolean;\n}\n"],"mappings":";AA0BA,MAAa,mBAAmB;AAChC,MAAa,4BAA4B"}
1
+ {"version":3,"file":"types.mjs","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { AgentCapabilities } from \"@ag-ui/core\";\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\n/**\n * More specific utility for records with at least one key\n */\nexport type NonEmptyRecord<T> =\n T extends Record<string, unknown>\n ? keyof T extends never\n ? never\n : T\n : never;\n\n/**\n * Type representing an agent's basic information\n */\nexport interface AgentDescription {\n name: string;\n className: string;\n description: string;\n capabilities?: AgentCapabilities;\n}\n\nexport type RuntimeMode = \"sse\" | \"intelligence\";\n\nexport const RUNTIME_MODE_SSE = \"sse\" as const;\nexport const RUNTIME_MODE_INTELLIGENCE = \"intelligence\" as const;\n\nexport interface IntelligenceRuntimeInfo {\n wsUrl: string;\n}\n\nexport interface ThreadEndpointRuntimeInfo {\n list: boolean;\n inspect: boolean;\n mutations: boolean;\n realtimeMetadata: boolean;\n}\n\nexport type RuntimeLicenseStatus =\n | \"valid\"\n | \"none\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"unknown\";\n\nexport interface A2UIRuntimeInfo {\n enabled: boolean;\n /**\n * Agent ids the runtime applies A2UI to. When omitted, A2UI applies to\n * every agent served by the runtime.\n */\n agents?: string[];\n}\n\nexport interface RuntimeInfo {\n version: string;\n agents: Record<string, AgentDescription>;\n audioFileTranscriptionEnabled: boolean;\n mode: RuntimeMode;\n intelligence?: IntelligenceRuntimeInfo;\n threadEndpoints?: ThreadEndpointRuntimeInfo;\n /**\n * @deprecated Use `a2ui` instead, which preserves per-agent scoping.\n * Kept for backward compatibility with older clients.\n */\n a2uiEnabled?: boolean;\n a2ui?: A2UIRuntimeInfo;\n openGenerativeUIEnabled?: boolean;\n licenseStatus?: RuntimeLicenseStatus;\n telemetryDisabled?: boolean;\n}\n"],"mappings":";AA0BA,MAAa,mBAAmB;AAChC,MAAa,4BAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/shared",
3
- "version": "1.61.0",
3
+ "version": "1.61.2",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -0,0 +1,33 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { createLicenseContextValue } from "../index";
3
+ import type { RuntimeLicenseStatus } from "../utils/types";
4
+
5
+ describe("createLicenseContextValue", () => {
6
+ it("fails open when no status is known", () => {
7
+ for (const status of [null, undefined] as const) {
8
+ const ctx = createLicenseContextValue(status);
9
+ expect(ctx.status).toBeNull();
10
+ expect(ctx.license).toBeNull();
11
+ expect(ctx.checkFeature("chat")).toBe(true);
12
+ expect(ctx.getLimit("chat")).toBeNull();
13
+ }
14
+ });
15
+
16
+ it.each(["valid", "none", "expiring", "unknown"] as RuntimeLicenseStatus[])(
17
+ "enables features for %s status",
18
+ (status) => {
19
+ const ctx = createLicenseContextValue(status);
20
+ expect(ctx.status).toBe(status);
21
+ expect(ctx.checkFeature("chat")).toBe(true);
22
+ },
23
+ );
24
+
25
+ it.each(["expired", "invalid"] as RuntimeLicenseStatus[])(
26
+ "disables features for %s status",
27
+ (status) => {
28
+ const ctx = createLicenseContextValue(status);
29
+ expect(ctx.status).toBe(status);
30
+ expect(ctx.checkFeature("chat")).toBe(false);
31
+ },
32
+ );
33
+ });
package/src/index.ts CHANGED
@@ -32,10 +32,8 @@ export type {
32
32
  LicenseOwner,
33
33
  } from "@copilotkit/license-verifier";
34
34
 
35
- import type {
36
- LicenseStatus,
37
- LicensePayload,
38
- } from "@copilotkit/license-verifier";
35
+ import type { LicensePayload } from "@copilotkit/license-verifier";
36
+ import type { RuntimeLicenseStatus } from "./utils/types";
39
37
 
40
38
  // LicenseContextValue was dropped from license-verifier's public API in
41
39
  // 0.3.0, so it is defined here. The context shape is owned by this package
@@ -46,9 +44,9 @@ import type {
46
44
  * Frontend providers create their own context using this shape.
47
45
  */
48
46
  export interface LicenseContextValue {
49
- /** The resolved license status after verification. Null if no token provided. */
50
- status: LicenseStatus | null;
51
- /** Convenience: the license payload if valid, null otherwise. */
47
+ /** Server-reported license status from the runtime's /info endpoint. Null until known. */
48
+ status: RuntimeLicenseStatus | null;
49
+ /** The license payload if available. Always null on the client; the payload stays server-side. */
52
50
  license: LicensePayload | null;
53
51
  /** Whether a specific feature is licensed. Returns true if no licensing is active (no token). */
54
52
  checkFeature: (feature: string) => boolean;
@@ -57,23 +55,28 @@ export interface LicenseContextValue {
57
55
  }
58
56
 
59
57
  /**
60
- * Client-safe license context factory.
58
+ * Client-safe license context factory, driven by the license status the
59
+ * runtime reports via /info.
61
60
  *
62
- * When status is null (no token provided), all features return true
63
- * (unlicensed = unrestricted, with branding). This is inlined here to
64
- * avoid importing the full license-verifier bundle (which depends on
65
- * Node's `crypto`) into browser bundles.
61
+ * Features are enabled unless the runtime definitively reports the license
62
+ * as "expired" or "invalid". A null/"none"/"unknown" status fails open
63
+ * (unlicensed = unrestricted, with branding), and "expiring" keeps features
64
+ * on while the provider surfaces a warning banner. Per-feature data is not
65
+ * in /info yet, so checkFeature is uniform across features and getLimit has
66
+ * no limits to report. This is inlined here to avoid importing the full
67
+ * license-verifier bundle (which depends on Node's `crypto`) into browser
68
+ * bundles.
66
69
  */
67
- export function createLicenseContextValue(status: null): {
68
- status: null;
69
- license: null;
70
- checkFeature: (feature: string) => boolean;
71
- getLimit: (feature: string) => number | null;
72
- } {
70
+ export function createLicenseContextValue(
71
+ status: RuntimeLicenseStatus | null | undefined,
72
+ ): LicenseContextValue {
73
+ const resolvedStatus = status ?? null;
74
+ const featuresEnabled =
75
+ resolvedStatus !== "expired" && resolvedStatus !== "invalid";
73
76
  return {
74
- status: null,
77
+ status: resolvedStatus,
75
78
  license: null,
76
- checkFeature: () => true,
79
+ checkFeature: () => featuresEnabled,
77
80
  getLimit: () => null,
78
81
  };
79
82
  }
@@ -31,6 +31,13 @@ export interface IntelligenceRuntimeInfo {
31
31
  wsUrl: string;
32
32
  }
33
33
 
34
+ export interface ThreadEndpointRuntimeInfo {
35
+ list: boolean;
36
+ inspect: boolean;
37
+ mutations: boolean;
38
+ realtimeMetadata: boolean;
39
+ }
40
+
34
41
  export type RuntimeLicenseStatus =
35
42
  | "valid"
36
43
  | "none"
@@ -54,6 +61,7 @@ export interface RuntimeInfo {
54
61
  audioFileTranscriptionEnabled: boolean;
55
62
  mode: RuntimeMode;
56
63
  intelligence?: IntelligenceRuntimeInfo;
64
+ threadEndpoints?: ThreadEndpointRuntimeInfo;
57
65
  /**
58
66
  * @deprecated Use `a2ui` instead, which preserves per-agent scoping.
59
67
  * Kept for backward compatibility with older clients.
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) Atai Barkai
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.