@revealui/ai 1.0.5 → 1.1.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.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * TypeSafe Jev — System One decision adapter.
3
+ *
4
+ * Not a chat model. Send state plus typed questions. The response is
5
+ * choices, scores, and noul probabilities. No TypeSafe SDK: one HTTPS POST.
6
+ * The key is the caller's TYPESAFE_API_KEY. RevealUI does not host one.
7
+ *
8
+ * Docs: https://docs.typesafe.ai/introduction/quickstart
9
+ */
10
+ export declare const JEV_MODEL = "jev-latest";
11
+ export declare const TYPESAFE_SYSTEMONE_URL = "https://api.typesafe.ai/v1/systemone";
12
+ export interface JevChoiceQuestion {
13
+ readonly type: 'choice';
14
+ readonly instructions: string;
15
+ readonly criteria: Readonly<Record<string, string>>;
16
+ }
17
+ export interface JevScoreQuestion {
18
+ readonly type: 'score';
19
+ readonly instructions: string;
20
+ readonly criteria: readonly string[];
21
+ }
22
+ export interface JevNoulQuestion {
23
+ readonly type: 'noul';
24
+ readonly instructions: string;
25
+ }
26
+ export type JevQuestion = JevChoiceQuestion | JevScoreQuestion | JevNoulQuestion;
27
+ export interface JevEvaluateInput {
28
+ readonly state: string | Record<string, unknown> | readonly unknown[];
29
+ readonly questions: Readonly<Record<string, JevQuestion>>;
30
+ readonly model?: string;
31
+ }
32
+ export interface JevUsage {
33
+ readonly input_tokens: number;
34
+ readonly output_tokens: number;
35
+ }
36
+ export interface JevEvaluateResult {
37
+ readonly model: string;
38
+ readonly answers: Readonly<Record<string, unknown>>;
39
+ readonly usage?: JevUsage;
40
+ }
41
+ export declare class JevConfigError extends Error {
42
+ constructor(message: string);
43
+ }
44
+ export declare function typesafeApiKey(env?: NodeJS.ProcessEnv): string;
45
+ /**
46
+ * One System One call. Does not generate text and is not the local snap default.
47
+ */
48
+ export declare function evaluateJev(input: JevEvaluateInput, options?: {
49
+ readonly fetchImpl?: typeof fetch;
50
+ readonly apiKey?: string;
51
+ readonly url?: string;
52
+ }): Promise<JevEvaluateResult>;
53
+ //# sourceMappingURL=typesafe-jev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typesafe-jev.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/typesafe-jev.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,SAAS,eAAe,CAAC;AACtC,eAAO,MAAM,sBAAsB,yCAAyC,CAAC;AAE7E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAEjF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,OAAO,EAAE,CAAC;IACtE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAED,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAM3E;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,gBAAgB,EACvB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/F,OAAO,CAAC,iBAAiB,CAAC,CAsB5B"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * TypeSafe Jev — System One decision adapter.
3
+ *
4
+ * Not a chat model. Send state plus typed questions. The response is
5
+ * choices, scores, and noul probabilities. No TypeSafe SDK: one HTTPS POST.
6
+ * The key is the caller's TYPESAFE_API_KEY. RevealUI does not host one.
7
+ *
8
+ * Docs: https://docs.typesafe.ai/introduction/quickstart
9
+ */
10
+ export const JEV_MODEL = 'jev-latest';
11
+ export const TYPESAFE_SYSTEMONE_URL = 'https://api.typesafe.ai/v1/systemone';
12
+ export class JevConfigError extends Error {
13
+ constructor(message) {
14
+ super(message);
15
+ this.name = 'JevConfigError';
16
+ }
17
+ }
18
+ export function typesafeApiKey(env = process.env) {
19
+ const key = env.TYPESAFE_API_KEY?.trim();
20
+ if (!key) {
21
+ throw new JevConfigError('TYPESAFE_API_KEY is required for Jev. RevealUI does not ship one.');
22
+ }
23
+ return key;
24
+ }
25
+ /**
26
+ * One System One call. Does not generate text and is not the local snap default.
27
+ */
28
+ export async function evaluateJev(input, options) {
29
+ const fetchImpl = options?.fetchImpl ?? fetch;
30
+ const response = await fetchImpl(options?.url ?? TYPESAFE_SYSTEMONE_URL, {
31
+ method: 'POST',
32
+ headers: {
33
+ Authorization: `Bearer ${options?.apiKey ?? typesafeApiKey()}`,
34
+ 'Content-Type': 'application/json',
35
+ },
36
+ body: JSON.stringify({
37
+ state: input.state,
38
+ model: input.model ?? JEV_MODEL,
39
+ questions: input.questions,
40
+ }),
41
+ });
42
+ if (!response.ok) {
43
+ throw new Error(`Jev request failed: HTTP ${response.status}`);
44
+ }
45
+ const body = (await response.json());
46
+ if (!body || typeof body !== 'object' || !body.answers) {
47
+ throw new Error('Jev response missing answers');
48
+ }
49
+ return body;
50
+ }
@@ -10,6 +10,7 @@ export * from './providers/groq.js';
10
10
  export * from './providers/inference-snaps.js';
11
11
  export * from './providers/ollama.js';
12
12
  export * from './providers/openai-compat.js';
13
+ export * from './providers/typesafe-jev.js';
13
14
  export * from './resolve.js';
14
15
  export * from './workspace-provider-config.js';
15
16
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/llm/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,aAAa,CAAC;AAE5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAE7C,cAAc,cAAc,CAAC;AAI7B,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/llm/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,aAAa,CAAC;AAE5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,cAAc,CAAC;AAI7B,cAAc,gCAAgC,CAAC"}
@@ -12,6 +12,7 @@ export * from './providers/groq.js';
12
12
  export * from './providers/inference-snaps.js';
13
13
  export * from './providers/ollama.js';
14
14
  export * from './providers/openai-compat.js';
15
+ export * from './providers/typesafe-jev.js';
15
16
  // Export the per-request client resolver (GAP-360 PR-2)
16
17
  export * from './resolve.js';
17
18
  // Export per-workspace provider registry (used by admin inference-config route
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revealui/ai",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "AI runtime for agent-driven products — agents, memory, LLM providers (Inference Snaps, Ollama, OpenAI-compatible), tools, and orchestration. Anthropic-SDK-free.",
5
5
  "keywords": [
6
6
  "agent",
@@ -25,20 +25,20 @@
25
25
  "dependencies": {
26
26
  "lru-cache": "^11.5.1",
27
27
  "zod": "^4.4.3",
28
- "@revealui/contracts": "0.9.0",
29
- "@revealui/core": "0.14.5",
30
- "@revealui/db": "0.10.2",
28
+ "@revealui/contracts": "0.12.0",
29
+ "@revealui/core": "0.15.0",
30
+ "@revealui/db": "0.11.0",
31
31
  "@revealui/resilience": "0.2.4"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@electric-sql/pglite": "^0.5.4",
35
35
  "@testing-library/react": "^16.3.2",
36
- "@vitest/coverage-v8": "^4.1.10",
36
+ "@vitest/coverage-v8": "^4.1.11",
37
37
  "jsdom": "29.1.1",
38
38
  "react": "19.2.8",
39
39
  "react-dom": "19.2.8",
40
40
  "typescript": "6.0.3",
41
- "vitest": "^4.1.10",
41
+ "vitest": "^4.1.11",
42
42
  "@revealui/dev": "0.1.0"
43
43
  },
44
44
  "engines": {