@molroo-io/sdk 0.6.2 → 0.7.1
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/README.md +100 -194
- package/dist/cjs/api-client.d.ts +2 -12
- package/dist/cjs/api-client.d.ts.map +1 -1
- package/dist/cjs/api-client.js +4 -42
- package/dist/cjs/errors.d.ts +1 -16
- package/dist/cjs/errors.d.ts.map +1 -1
- package/dist/cjs/errors.js +2 -18
- package/dist/cjs/events/types.d.ts +14 -21
- package/dist/cjs/events/types.d.ts.map +1 -1
- package/dist/cjs/events/types.js +0 -11
- package/dist/cjs/index.d.ts +26 -48
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +29 -52
- package/dist/cjs/llm/resolve.d.ts +4 -22
- package/dist/cjs/llm/resolve.d.ts.map +1 -1
- package/dist/cjs/llm/resolve.js +19 -7
- package/dist/cjs/llm/vercel-ai/adapter.d.ts +4 -10
- package/dist/cjs/llm/vercel-ai/adapter.d.ts.map +1 -1
- package/dist/cjs/llm/vercel-ai/adapter.js +6 -152
- package/dist/cjs/llm/vercel-ai/config.d.ts +8 -5
- package/dist/cjs/llm/vercel-ai/config.d.ts.map +1 -1
- package/dist/cjs/memory/in-memory.d.ts +14 -37
- package/dist/cjs/memory/in-memory.d.ts.map +1 -1
- package/dist/cjs/memory/in-memory.js +22 -85
- package/dist/cjs/memory/recall.d.ts +10 -21
- package/dist/cjs/memory/recall.d.ts.map +1 -1
- package/dist/cjs/memory/recall.js +12 -91
- package/dist/cjs/memory/types.d.ts +46 -186
- package/dist/cjs/memory/types.d.ts.map +1 -1
- package/dist/cjs/memory/types.js +0 -10
- package/dist/cjs/persona/chat-orchestrator.d.ts +46 -0
- package/dist/cjs/persona/chat-orchestrator.d.ts.map +1 -0
- package/dist/cjs/persona/chat-orchestrator.js +240 -0
- package/dist/cjs/persona/event-emitter.d.ts +7 -0
- package/dist/cjs/persona/event-emitter.d.ts.map +1 -0
- package/dist/cjs/persona/event-emitter.js +53 -0
- package/dist/cjs/persona/memory-pipeline.d.ts +26 -0
- package/dist/cjs/persona/memory-pipeline.d.ts.map +1 -0
- package/dist/cjs/persona/memory-pipeline.js +69 -0
- package/dist/cjs/persona.d.ts +56 -187
- package/dist/cjs/persona.d.ts.map +1 -1
- package/dist/cjs/persona.js +62 -638
- package/dist/cjs/shared/appraisal.d.ts +26 -0
- package/dist/cjs/shared/appraisal.d.ts.map +1 -0
- package/dist/cjs/shared/appraisal.js +45 -0
- package/dist/cjs/shared/client-factory.d.ts +23 -0
- package/dist/cjs/shared/client-factory.d.ts.map +1 -0
- package/dist/cjs/shared/client-factory.js +48 -0
- package/dist/cjs/shared/errors.d.ts +21 -0
- package/dist/cjs/shared/errors.d.ts.map +1 -0
- package/dist/cjs/shared/errors.js +29 -0
- package/dist/cjs/world/client.d.ts +2 -9
- package/dist/cjs/world/client.d.ts.map +1 -1
- package/dist/cjs/world/client.js +7 -34
- package/dist/cjs/world/errors.d.ts +1 -8
- package/dist/cjs/world/errors.d.ts.map +1 -1
- package/dist/cjs/world/errors.js +2 -12
- package/dist/cjs/world/index.d.ts +2 -2
- package/dist/cjs/world/index.d.ts.map +1 -1
- package/dist/cjs/world/types.d.ts +32 -5
- package/dist/cjs/world/types.d.ts.map +1 -1
- package/dist/cjs/world/world-domain.d.ts.map +1 -1
- package/dist/cjs/world/world-domain.js +4 -32
- package/dist/cjs/world/world-persona.d.ts +17 -12
- package/dist/cjs/world/world-persona.d.ts.map +1 -1
- package/dist/cjs/world/world-persona.js +6 -18
- package/dist/cjs/world/world.d.ts +28 -5
- package/dist/cjs/world/world.d.ts.map +1 -1
- package/dist/cjs/world/world.js +13 -11
- package/dist/esm/api-client.d.ts +2 -12
- package/dist/esm/api-client.d.ts.map +1 -1
- package/dist/esm/api-client.js +3 -38
- package/dist/esm/errors.d.ts +1 -16
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/errors.js +1 -17
- package/dist/esm/events/types.d.ts +14 -21
- package/dist/esm/events/types.d.ts.map +1 -1
- package/dist/esm/events/types.js +0 -11
- package/dist/esm/index.d.ts +26 -48
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +25 -38
- package/dist/esm/llm/resolve.d.ts +4 -22
- package/dist/esm/llm/resolve.d.ts.map +1 -1
- package/dist/esm/llm/resolve.js +20 -8
- package/dist/esm/llm/vercel-ai/adapter.d.ts +4 -10
- package/dist/esm/llm/vercel-ai/adapter.d.ts.map +1 -1
- package/dist/esm/llm/vercel-ai/adapter.js +6 -119
- package/dist/esm/llm/vercel-ai/config.d.ts +8 -5
- package/dist/esm/llm/vercel-ai/config.d.ts.map +1 -1
- package/dist/esm/memory/in-memory.d.ts +14 -37
- package/dist/esm/memory/in-memory.d.ts.map +1 -1
- package/dist/esm/memory/in-memory.js +20 -83
- package/dist/esm/memory/recall.d.ts +10 -21
- package/dist/esm/memory/recall.d.ts.map +1 -1
- package/dist/esm/memory/recall.js +12 -91
- package/dist/esm/memory/types.d.ts +46 -186
- package/dist/esm/memory/types.d.ts.map +1 -1
- package/dist/esm/memory/types.js +1 -9
- package/dist/esm/persona/chat-orchestrator.d.ts +46 -0
- package/dist/esm/persona/chat-orchestrator.d.ts.map +1 -0
- package/dist/esm/persona/chat-orchestrator.js +204 -0
- package/dist/esm/persona/event-emitter.d.ts +7 -0
- package/dist/esm/persona/event-emitter.d.ts.map +1 -0
- package/dist/esm/persona/event-emitter.js +50 -0
- package/dist/esm/persona/memory-pipeline.d.ts +26 -0
- package/dist/esm/persona/memory-pipeline.d.ts.map +1 -0
- package/dist/esm/persona/memory-pipeline.js +65 -0
- package/dist/esm/persona.d.ts +56 -187
- package/dist/esm/persona.d.ts.map +1 -1
- package/dist/esm/persona.js +62 -638
- package/dist/esm/shared/appraisal.d.ts +26 -0
- package/dist/esm/shared/appraisal.d.ts.map +1 -0
- package/dist/esm/shared/appraisal.js +40 -0
- package/dist/esm/shared/client-factory.d.ts +23 -0
- package/dist/esm/shared/client-factory.d.ts.map +1 -0
- package/dist/esm/shared/client-factory.js +41 -0
- package/dist/esm/shared/errors.d.ts +21 -0
- package/dist/esm/shared/errors.d.ts.map +1 -0
- package/dist/esm/shared/errors.js +24 -0
- package/dist/esm/world/client.d.ts +2 -9
- package/dist/esm/world/client.d.ts.map +1 -1
- package/dist/esm/world/client.js +6 -30
- package/dist/esm/world/errors.d.ts +1 -8
- package/dist/esm/world/errors.d.ts.map +1 -1
- package/dist/esm/world/errors.js +1 -11
- package/dist/esm/world/index.d.ts +2 -2
- package/dist/esm/world/index.d.ts.map +1 -1
- package/dist/esm/world/types.d.ts +32 -5
- package/dist/esm/world/types.d.ts.map +1 -1
- package/dist/esm/world/world-domain.d.ts.map +1 -1
- package/dist/esm/world/world-domain.js +4 -32
- package/dist/esm/world/world-persona.d.ts +17 -12
- package/dist/esm/world/world-persona.d.ts.map +1 -1
- package/dist/esm/world/world-persona.js +6 -18
- package/dist/esm/world/world.d.ts +28 -5
- package/dist/esm/world/world.d.ts.map +1 -1
- package/dist/esm/world/world.js +13 -11
- package/package.json +4 -101
- package/dist/cjs/embedding/cloudflare.d.ts +0 -15
- package/dist/cjs/embedding/cloudflare.d.ts.map +0 -1
- package/dist/cjs/embedding/cloudflare.js +0 -16
- package/dist/cjs/embedding/cohere.d.ts +0 -8
- package/dist/cjs/embedding/cohere.d.ts.map +0 -1
- package/dist/cjs/embedding/cohere.js +0 -31
- package/dist/cjs/embedding/index.d.ts +0 -9
- package/dist/cjs/embedding/index.d.ts.map +0 -1
- package/dist/cjs/embedding/index.js +0 -11
- package/dist/cjs/embedding/local.d.ts +0 -6
- package/dist/cjs/embedding/local.d.ts.map +0 -1
- package/dist/cjs/embedding/local.js +0 -28
- package/dist/cjs/embedding/openai.d.ts +0 -9
- package/dist/cjs/embedding/openai.d.ts.map +0 -1
- package/dist/cjs/embedding/openai.js +0 -26
- package/dist/cjs/events/console.d.ts +0 -25
- package/dist/cjs/events/console.d.ts.map +0 -1
- package/dist/cjs/events/console.js +0 -41
- package/dist/cjs/events/webhook.d.ts +0 -30
- package/dist/cjs/events/webhook.d.ts.map +0 -1
- package/dist/cjs/events/webhook.js +0 -79
- package/dist/cjs/memory/cloudflare/index.d.ts +0 -3
- package/dist/cjs/memory/cloudflare/index.d.ts.map +0 -1
- package/dist/cjs/memory/cloudflare/index.js +0 -5
- package/dist/cjs/memory/cloudflare/vectorize.d.ts +0 -62
- package/dist/cjs/memory/cloudflare/vectorize.d.ts.map +0 -1
- package/dist/cjs/memory/cloudflare/vectorize.js +0 -55
- package/dist/cjs/memory/in-memory-semantic.d.ts +0 -16
- package/dist/cjs/memory/in-memory-semantic.d.ts.map +0 -1
- package/dist/cjs/memory/in-memory-semantic.js +0 -57
- package/dist/cjs/memory/pinecone/index.d.ts +0 -7
- package/dist/cjs/memory/pinecone/index.d.ts.map +0 -1
- package/dist/cjs/memory/pinecone/index.js +0 -8
- package/dist/cjs/memory/pinecone/memory-adapter.d.ts +0 -62
- package/dist/cjs/memory/pinecone/memory-adapter.d.ts.map +0 -1
- package/dist/cjs/memory/pinecone/memory-adapter.js +0 -220
- package/dist/cjs/memory/pinecone/semantic.d.ts +0 -44
- package/dist/cjs/memory/pinecone/semantic.d.ts.map +0 -1
- package/dist/cjs/memory/pinecone/semantic.js +0 -90
- package/dist/cjs/memory/sqlite/index.d.ts +0 -3
- package/dist/cjs/memory/sqlite/index.d.ts.map +0 -1
- package/dist/cjs/memory/sqlite/index.js +0 -5
- package/dist/cjs/memory/sqlite/memory-adapter.d.ts +0 -58
- package/dist/cjs/memory/sqlite/memory-adapter.d.ts.map +0 -1
- package/dist/cjs/memory/sqlite/memory-adapter.js +0 -336
- package/dist/cjs/memory/sqlite/schema.d.ts +0 -4
- package/dist/cjs/memory/sqlite/schema.d.ts.map +0 -1
- package/dist/cjs/memory/sqlite/schema.js +0 -91
- package/dist/cjs/memory/supabase/index.d.ts +0 -7
- package/dist/cjs/memory/supabase/index.d.ts.map +0 -1
- package/dist/cjs/memory/supabase/index.js +0 -8
- package/dist/cjs/memory/supabase/memory-adapter.d.ts +0 -67
- package/dist/cjs/memory/supabase/memory-adapter.d.ts.map +0 -1
- package/dist/cjs/memory/supabase/memory-adapter.js +0 -335
- package/dist/cjs/memory/supabase/semantic.d.ts +0 -44
- package/dist/cjs/memory/supabase/semantic.d.ts.map +0 -1
- package/dist/cjs/memory/supabase/semantic.js +0 -72
- package/dist/esm/embedding/cloudflare.d.ts +0 -15
- package/dist/esm/embedding/cloudflare.d.ts.map +0 -1
- package/dist/esm/embedding/cloudflare.js +0 -13
- package/dist/esm/embedding/cohere.d.ts +0 -8
- package/dist/esm/embedding/cohere.d.ts.map +0 -1
- package/dist/esm/embedding/cohere.js +0 -28
- package/dist/esm/embedding/index.d.ts +0 -9
- package/dist/esm/embedding/index.d.ts.map +0 -1
- package/dist/esm/embedding/index.js +0 -4
- package/dist/esm/embedding/local.d.ts +0 -6
- package/dist/esm/embedding/local.d.ts.map +0 -1
- package/dist/esm/embedding/local.js +0 -25
- package/dist/esm/embedding/openai.d.ts +0 -9
- package/dist/esm/embedding/openai.d.ts.map +0 -1
- package/dist/esm/embedding/openai.js +0 -23
- package/dist/esm/events/console.d.ts +0 -25
- package/dist/esm/events/console.d.ts.map +0 -1
- package/dist/esm/events/console.js +0 -37
- package/dist/esm/events/webhook.d.ts +0 -30
- package/dist/esm/events/webhook.d.ts.map +0 -1
- package/dist/esm/events/webhook.js +0 -75
- package/dist/esm/memory/cloudflare/index.d.ts +0 -3
- package/dist/esm/memory/cloudflare/index.d.ts.map +0 -1
- package/dist/esm/memory/cloudflare/index.js +0 -1
- package/dist/esm/memory/cloudflare/vectorize.d.ts +0 -62
- package/dist/esm/memory/cloudflare/vectorize.d.ts.map +0 -1
- package/dist/esm/memory/cloudflare/vectorize.js +0 -51
- package/dist/esm/memory/in-memory-semantic.d.ts +0 -16
- package/dist/esm/memory/in-memory-semantic.d.ts.map +0 -1
- package/dist/esm/memory/in-memory-semantic.js +0 -53
- package/dist/esm/memory/pinecone/index.d.ts +0 -7
- package/dist/esm/memory/pinecone/index.d.ts.map +0 -1
- package/dist/esm/memory/pinecone/index.js +0 -3
- package/dist/esm/memory/pinecone/memory-adapter.d.ts +0 -62
- package/dist/esm/memory/pinecone/memory-adapter.d.ts.map +0 -1
- package/dist/esm/memory/pinecone/memory-adapter.js +0 -216
- package/dist/esm/memory/pinecone/semantic.d.ts +0 -44
- package/dist/esm/memory/pinecone/semantic.d.ts.map +0 -1
- package/dist/esm/memory/pinecone/semantic.js +0 -86
- package/dist/esm/memory/sqlite/index.d.ts +0 -3
- package/dist/esm/memory/sqlite/index.d.ts.map +0 -1
- package/dist/esm/memory/sqlite/index.js +0 -1
- package/dist/esm/memory/sqlite/memory-adapter.d.ts +0 -58
- package/dist/esm/memory/sqlite/memory-adapter.d.ts.map +0 -1
- package/dist/esm/memory/sqlite/memory-adapter.js +0 -296
- package/dist/esm/memory/sqlite/schema.d.ts +0 -4
- package/dist/esm/memory/sqlite/schema.d.ts.map +0 -1
- package/dist/esm/memory/sqlite/schema.js +0 -86
- package/dist/esm/memory/supabase/index.d.ts +0 -7
- package/dist/esm/memory/supabase/index.d.ts.map +0 -1
- package/dist/esm/memory/supabase/index.js +0 -3
- package/dist/esm/memory/supabase/memory-adapter.d.ts +0 -67
- package/dist/esm/memory/supabase/memory-adapter.d.ts.map +0 -1
- package/dist/esm/memory/supabase/memory-adapter.js +0 -331
- package/dist/esm/memory/supabase/semantic.d.ts +0 -44
- package/dist/esm/memory/supabase/semantic.d.ts.map +0 -1
- package/dist/esm/memory/supabase/semantic.js +0 -68
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared appraisal conversion utilities.
|
|
3
|
+
*
|
|
4
|
+
* The World SDK uses camelCase AppraisalVector (now called Appraisal),
|
|
5
|
+
* while the API wire format uses snake_case. These helpers convert between them.
|
|
6
|
+
*/
|
|
7
|
+
import type { AppraisalVector as WireAppraisal } from '../types';
|
|
8
|
+
/** camelCase appraisal shape used by World SDK. */
|
|
9
|
+
export interface Appraisal {
|
|
10
|
+
goalRelevance: number;
|
|
11
|
+
goalCongruence: number;
|
|
12
|
+
expectedness: number;
|
|
13
|
+
controllability: number;
|
|
14
|
+
agency: number;
|
|
15
|
+
normCompatibility: number;
|
|
16
|
+
internalStandards: number;
|
|
17
|
+
adjustmentPotential: number;
|
|
18
|
+
urgency: number;
|
|
19
|
+
}
|
|
20
|
+
/** Convert camelCase Appraisal → snake_case wire format. */
|
|
21
|
+
export declare function toWireAppraisal(v: Appraisal): WireAppraisal;
|
|
22
|
+
/** Convert snake_case wire format → camelCase Appraisal. */
|
|
23
|
+
export declare function fromWireAppraisal(raw: Record<string, number>): Appraisal;
|
|
24
|
+
/** Neutral appraisal vector (all dimensions at baseline). */
|
|
25
|
+
export declare const NEUTRAL_APPRAISAL: WireAppraisal;
|
|
26
|
+
//# sourceMappingURL=appraisal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appraisal.d.ts","sourceRoot":"","sources":["../../../src/shared/appraisal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,eAAe,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AAEjE,mDAAmD;AACnD,MAAM,WAAW,SAAS;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,4DAA4D;AAC5D,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,GAAG,aAAa,CAY3D;AAED,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAYxE;AAED,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,EAAE,aAU9B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Convert camelCase Appraisal → snake_case wire format. */
|
|
2
|
+
export function toWireAppraisal(v) {
|
|
3
|
+
return {
|
|
4
|
+
goal_relevance: v.goalRelevance,
|
|
5
|
+
goal_congruence: v.goalCongruence,
|
|
6
|
+
expectedness: v.expectedness,
|
|
7
|
+
controllability: v.controllability,
|
|
8
|
+
agency: v.agency,
|
|
9
|
+
norm_compatibility: v.normCompatibility,
|
|
10
|
+
internal_standards: v.internalStandards,
|
|
11
|
+
adjustment_potential: v.adjustmentPotential,
|
|
12
|
+
urgency: v.urgency,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Convert snake_case wire format → camelCase Appraisal. */
|
|
16
|
+
export function fromWireAppraisal(raw) {
|
|
17
|
+
return {
|
|
18
|
+
goalRelevance: raw.goal_relevance,
|
|
19
|
+
goalCongruence: raw.goal_congruence,
|
|
20
|
+
expectedness: raw.expectedness,
|
|
21
|
+
controllability: raw.controllability,
|
|
22
|
+
agency: raw.agency,
|
|
23
|
+
normCompatibility: raw.norm_compatibility,
|
|
24
|
+
internalStandards: raw.internal_standards,
|
|
25
|
+
adjustmentPotential: raw.adjustment_potential,
|
|
26
|
+
urgency: raw.urgency,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Neutral appraisal vector (all dimensions at baseline). */
|
|
30
|
+
export const NEUTRAL_APPRAISAL = Object.freeze({
|
|
31
|
+
goal_relevance: 0,
|
|
32
|
+
goal_congruence: 0,
|
|
33
|
+
expectedness: 0.5,
|
|
34
|
+
controllability: 0.5,
|
|
35
|
+
agency: 0,
|
|
36
|
+
norm_compatibility: 0,
|
|
37
|
+
internal_standards: 0,
|
|
38
|
+
adjustment_potential: 0.5,
|
|
39
|
+
urgency: 0.5,
|
|
40
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MolrooApiError } from './errors';
|
|
2
|
+
type ErrorConstructor = new (message: string, code: string, status: number) => MolrooApiError;
|
|
3
|
+
/**
|
|
4
|
+
* Create a typed openapi-fetch client with error middleware.
|
|
5
|
+
*
|
|
6
|
+
* @param opts.baseUrl - API base URL (trailing slash is stripped).
|
|
7
|
+
* @param opts.apiKey - API key for authentication.
|
|
8
|
+
* @param opts.ErrorClass - Error class to throw on non-OK responses.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createTypedClient<Paths extends {}>(opts: {
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
apiKey: string;
|
|
13
|
+
ErrorClass: ErrorConstructor;
|
|
14
|
+
}): import("openapi-fetch").Client<Paths, `${string}/${string}`>;
|
|
15
|
+
/**
|
|
16
|
+
* Unwrap the `{ result: T }` envelope from API responses.
|
|
17
|
+
* Returns an empty object cast to T when result is undefined.
|
|
18
|
+
*/
|
|
19
|
+
export declare function unwrap<T>(data: {
|
|
20
|
+
result?: unknown;
|
|
21
|
+
} | undefined): T;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=client-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-factory.d.ts","sourceRoot":"","sources":["../../../src/shared/client-factory.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,KAAK,gBAAgB,GAAG,KAAK,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,cAAc,CAAC;AAE9F;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,EAAE,EAAE,IAAI,EAAE;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,gBAAgB,CAAC;CAC9B,gEAwBA;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,GAAG,CAAC,CAEnE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared client factory for creating typed openapi-fetch clients.
|
|
3
|
+
*
|
|
4
|
+
* Both the Persona SDK and World SDK delegate to this module,
|
|
5
|
+
* eliminating duplicated error middleware and unwrap logic.
|
|
6
|
+
*/
|
|
7
|
+
import createClient from 'openapi-fetch';
|
|
8
|
+
/**
|
|
9
|
+
* Create a typed openapi-fetch client with error middleware.
|
|
10
|
+
*
|
|
11
|
+
* @param opts.baseUrl - API base URL (trailing slash is stripped).
|
|
12
|
+
* @param opts.apiKey - API key for authentication.
|
|
13
|
+
* @param opts.ErrorClass - Error class to throw on non-OK responses.
|
|
14
|
+
*/
|
|
15
|
+
export function createTypedClient(opts) {
|
|
16
|
+
const errorMiddleware = {
|
|
17
|
+
async onResponse({ response }) {
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
const body = await response.clone().json().catch(() => ({}));
|
|
20
|
+
const err = body;
|
|
21
|
+
throw new opts.ErrorClass(err.error?.message ?? `API error ${response.status}`, err.error?.code ?? 'UNKNOWN', response.status);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const client = createClient({
|
|
26
|
+
baseUrl: opts.baseUrl.replace(/\/$/, ''),
|
|
27
|
+
headers: {
|
|
28
|
+
'Content-Type': 'application/json',
|
|
29
|
+
'X-API-Key': opts.apiKey,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
client.use(errorMiddleware);
|
|
33
|
+
return client;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Unwrap the `{ result: T }` envelope from API responses.
|
|
37
|
+
* Returns an empty object cast to T when result is undefined.
|
|
38
|
+
*/
|
|
39
|
+
export function unwrap(data) {
|
|
40
|
+
return (data?.result ?? {});
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified error hierarchy for the molroo SDK.
|
|
3
|
+
*
|
|
4
|
+
* `instanceof MolrooApiError` catches ALL API errors (persona + world).
|
|
5
|
+
* `instanceof WorldApiError` catches world-only errors.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MolrooApiError extends Error {
|
|
8
|
+
/** Machine-readable error code (e.g., 'ENTITY_NOT_FOUND', 'UNAUTHORIZED'). */
|
|
9
|
+
readonly code: string;
|
|
10
|
+
/** HTTP status code. */
|
|
11
|
+
readonly status: number;
|
|
12
|
+
constructor(message: string,
|
|
13
|
+
/** Machine-readable error code (e.g., 'ENTITY_NOT_FOUND', 'UNAUTHORIZED'). */
|
|
14
|
+
code: string,
|
|
15
|
+
/** HTTP status code. */
|
|
16
|
+
status: number);
|
|
17
|
+
}
|
|
18
|
+
export declare class WorldApiError extends MolrooApiError {
|
|
19
|
+
constructor(message: string, code: string, status: number);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/shared/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qBAAa,cAAe,SAAQ,KAAK;IAGrC,8EAA8E;aAC9D,IAAI,EAAE,MAAM;IAC5B,wBAAwB;aACR,MAAM,EAAE,MAAM;gBAJ9B,OAAO,EAAE,MAAM;IACf,8EAA8E;IAC9D,IAAI,EAAE,MAAM;IAC5B,wBAAwB;IACR,MAAM,EAAE,MAAM;CAKjC;AAED,qBAAa,aAAc,SAAQ,cAAc;gBACnC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI1D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified error hierarchy for the molroo SDK.
|
|
3
|
+
*
|
|
4
|
+
* `instanceof MolrooApiError` catches ALL API errors (persona + world).
|
|
5
|
+
* `instanceof WorldApiError` catches world-only errors.
|
|
6
|
+
*/
|
|
7
|
+
export class MolrooApiError extends Error {
|
|
8
|
+
constructor(message,
|
|
9
|
+
/** Machine-readable error code (e.g., 'ENTITY_NOT_FOUND', 'UNAUTHORIZED'). */
|
|
10
|
+
code,
|
|
11
|
+
/** HTTP status code. */
|
|
12
|
+
status) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.status = status;
|
|
16
|
+
this.name = 'MolrooApiError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class WorldApiError extends MolrooApiError {
|
|
20
|
+
constructor(message, code, status) {
|
|
21
|
+
super(message, code, status);
|
|
22
|
+
this.name = 'WorldApiError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { paths } from '../generated/world-api';
|
|
2
|
+
import { unwrap } from '../shared/client-factory';
|
|
2
3
|
export interface WorldClientOptions {
|
|
3
4
|
baseUrl: string;
|
|
4
5
|
apiKey: string;
|
|
@@ -24,13 +25,5 @@ export interface WorldClientOptions {
|
|
|
24
25
|
export declare function createWorldClient(options: WorldClientOptions): import("openapi-fetch").Client<paths, `${string}/${string}`>;
|
|
25
26
|
/** Type alias for the openapi-fetch client instance returned by createWorldClient. */
|
|
26
27
|
export type ApiClient = ReturnType<typeof createWorldClient>;
|
|
27
|
-
|
|
28
|
-
* Unwrap the `{ result: T }` envelope used by the World API.
|
|
29
|
-
* Returns an empty object cast to T when result is undefined.
|
|
30
|
-
*
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
export declare function unwrap<T>(data: {
|
|
34
|
-
result?: unknown;
|
|
35
|
-
} | undefined): T;
|
|
28
|
+
export { unwrap };
|
|
36
29
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/world/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/world/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAqB,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAErE,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,gEAM5D;AAED,sFAAsF;AACtF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/dist/esm/world/client.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import createClient from 'openapi-fetch';
|
|
2
1
|
import { WorldApiError } from './errors';
|
|
3
|
-
|
|
4
|
-
* Middleware: throw WorldApiError on non-OK responses.
|
|
5
|
-
*/
|
|
6
|
-
const errorMiddleware = {
|
|
7
|
-
async onResponse({ response }) {
|
|
8
|
-
if (!response.ok) {
|
|
9
|
-
const body = await response.clone().json().catch(() => ({}));
|
|
10
|
-
const err = body;
|
|
11
|
-
throw new WorldApiError(err.error?.message ?? `API error ${response.status}`, err.error?.code ?? 'UNKNOWN', response.status);
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
};
|
|
2
|
+
import { createTypedClient, unwrap } from '../shared/client-factory';
|
|
15
3
|
/**
|
|
16
4
|
* Create a typed API client for the molroo World API.
|
|
17
5
|
*
|
|
@@ -31,22 +19,10 @@ const errorMiddleware = {
|
|
|
31
19
|
* ```
|
|
32
20
|
*/
|
|
33
21
|
export function createWorldClient(options) {
|
|
34
|
-
|
|
35
|
-
baseUrl: options.baseUrl
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'X-API-Key': options.apiKey,
|
|
39
|
-
},
|
|
22
|
+
return createTypedClient({
|
|
23
|
+
baseUrl: options.baseUrl,
|
|
24
|
+
apiKey: options.apiKey,
|
|
25
|
+
ErrorClass: WorldApiError,
|
|
40
26
|
});
|
|
41
|
-
client.use(errorMiddleware);
|
|
42
|
-
return client;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Unwrap the `{ result: T }` envelope used by the World API.
|
|
46
|
-
* Returns an empty object cast to T when result is undefined.
|
|
47
|
-
*
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
export function unwrap(data) {
|
|
51
|
-
return (data?.result ?? {});
|
|
52
27
|
}
|
|
28
|
+
export { unwrap };
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Typed API error thrown by the World SDK client.
|
|
3
|
-
*/
|
|
4
|
-
export declare class WorldApiError extends Error {
|
|
5
|
-
readonly code: string;
|
|
6
|
-
readonly status: number;
|
|
7
|
-
constructor(message: string, code: string, status: number);
|
|
8
|
-
}
|
|
1
|
+
export { WorldApiError } from '../shared/errors';
|
|
9
2
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/world/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/world/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/esm/world/errors.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Typed API error thrown by the World SDK client.
|
|
3
|
-
*/
|
|
4
|
-
export class WorldApiError extends Error {
|
|
5
|
-
constructor(message, code, status) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.code = code;
|
|
8
|
-
this.status = status;
|
|
9
|
-
this.name = 'WorldApiError';
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
export { WorldApiError } from '../shared/errors';
|
|
@@ -2,8 +2,8 @@ export { Molroo } from './world';
|
|
|
2
2
|
export type { MolrooOptions, PersonaOptions } from './world';
|
|
3
3
|
export { World } from './world-domain';
|
|
4
4
|
export { WorldPersona } from './world-persona';
|
|
5
|
-
export type { WorldPersonaOptions, WorldLLM, LLMMessage, ReactOptions, ReactResult, PersonaState, PersonaEmotion, PromptContext, PersonaDetail, } from './world-persona';
|
|
6
|
-
export type { WorldData, CreateWorldOptions, UpdateWorldOptions, PaginationOptions, AddPersonaOptions, WorldPersonaRef, AppraisalVector, CreateActionOptions, ActionData, ActionRef, EntityType, RelationshipEndpoint, SetRelationshipOptions, InteractOptions, InteractResult, EventEntry, } from './types';
|
|
5
|
+
export type { WorldPersonaOptions, WorldLLM, LLMMessage, ReactOptions, ReactResult, WorldPersonaState, PersonaState, PersonaEmotion, PromptContext, PersonaDetail, } from './world-persona';
|
|
6
|
+
export type { WorldData, CreateWorldOptions, UpdateWorldOptions, PaginationOptions, AddPersonaOptions, WorldPersonaRef, Appraisal, AppraisalVector, CreateActionOptions, ActionData, ActionRef, EntityType, RelationshipEndpoint, SetRelationshipOptions, InteractOptions, InteractResult, EventEntry, } from './types';
|
|
7
7
|
export { WorldApiError } from './errors';
|
|
8
8
|
export { createWorldClient } from './client';
|
|
9
9
|
export type { WorldClientOptions } from './client';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/world/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EACV,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/world/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EACV,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -44,7 +44,7 @@ export interface WorldPersonaRef {
|
|
|
44
44
|
personaConfigId: string;
|
|
45
45
|
createdAt: number;
|
|
46
46
|
}
|
|
47
|
-
export interface
|
|
47
|
+
export interface Appraisal {
|
|
48
48
|
goalRelevance: number;
|
|
49
49
|
goalCongruence: number;
|
|
50
50
|
expectedness: number;
|
|
@@ -55,15 +55,17 @@ export interface AppraisalVector {
|
|
|
55
55
|
adjustmentPotential: number;
|
|
56
56
|
urgency: number;
|
|
57
57
|
}
|
|
58
|
+
/** @deprecated Use {@link Appraisal} instead. */
|
|
59
|
+
export type AppraisalVector = Appraisal;
|
|
58
60
|
export interface CreateActionOptions {
|
|
59
61
|
name: string;
|
|
60
62
|
description?: string;
|
|
61
|
-
appraisalVector:
|
|
63
|
+
appraisalVector: Appraisal;
|
|
62
64
|
}
|
|
63
65
|
export interface ActionData {
|
|
64
66
|
name: string;
|
|
65
67
|
description: string;
|
|
66
|
-
appraisalVector:
|
|
68
|
+
appraisalVector: Appraisal;
|
|
67
69
|
isDefault: boolean;
|
|
68
70
|
}
|
|
69
71
|
export interface ActionRef {
|
|
@@ -88,12 +90,37 @@ export interface InteractOptions {
|
|
|
88
90
|
action?: string;
|
|
89
91
|
actionLabel?: string;
|
|
90
92
|
stimulusDescription?: string;
|
|
91
|
-
appraisal?:
|
|
93
|
+
appraisal?: Appraisal;
|
|
92
94
|
actor?: string;
|
|
93
95
|
actorType?: 'user' | 'persona';
|
|
94
96
|
}
|
|
95
97
|
export interface InteractResult {
|
|
96
|
-
|
|
98
|
+
action: string;
|
|
99
|
+
target: string;
|
|
100
|
+
emotion: {
|
|
101
|
+
vad: {
|
|
102
|
+
V: number;
|
|
103
|
+
A: number;
|
|
104
|
+
D: number;
|
|
105
|
+
};
|
|
106
|
+
delta?: {
|
|
107
|
+
V: number;
|
|
108
|
+
A: number;
|
|
109
|
+
D: number;
|
|
110
|
+
};
|
|
111
|
+
label: string;
|
|
112
|
+
secondary_label: string | null;
|
|
113
|
+
intensity: number;
|
|
114
|
+
};
|
|
115
|
+
mood?: {
|
|
116
|
+
vad: {
|
|
117
|
+
V: number;
|
|
118
|
+
A: number;
|
|
119
|
+
D: number;
|
|
120
|
+
};
|
|
121
|
+
label: string;
|
|
122
|
+
};
|
|
123
|
+
somatic: string[];
|
|
97
124
|
}
|
|
98
125
|
export interface EventEntry {
|
|
99
126
|
[key: string]: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/world/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACjC,YAAY,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACjC,YAAY,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MA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CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world-domain.d.ts","sourceRoot":"","sources":["../../../src/world/world-domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"world-domain.d.ts","sourceRoot":"","sources":["../../../src/world/world-domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAMjB;;;;;GAKG;AACH,qBAAa,KAAK;IAChB,gBAAgB;IAChB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAY;IACpC,OAAO,CAAC,KAAK,CAAY;IAEzB,oEAAoE;gBACxD,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS;IAO9C,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,IAAI,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S7C,mCAAmC;IAC7B,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/D,4CAA4C;IACtC,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAmBjE,6CAA6C;IACvC,SAAS,CACb,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC;QAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAiBhE"}
|
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
// INFO: @F001 Domain class wrapping World API — see plan step 3
|
|
2
2
|
import { unwrap } from './client';
|
|
3
3
|
import { WorldPersona } from './world-persona';
|
|
4
|
-
|
|
5
|
-
// Internal helpers (not exported)
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
function toApiAppraisal(v) {
|
|
8
|
-
return {
|
|
9
|
-
goal_relevance: v.goalRelevance,
|
|
10
|
-
goal_congruence: v.goalCongruence,
|
|
11
|
-
expectedness: v.expectedness,
|
|
12
|
-
controllability: v.controllability,
|
|
13
|
-
agency: v.agency,
|
|
14
|
-
norm_compatibility: v.normCompatibility,
|
|
15
|
-
internal_standards: v.internalStandards,
|
|
16
|
-
adjustment_potential: v.adjustmentPotential,
|
|
17
|
-
urgency: v.urgency,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function fromApiAppraisal(raw) {
|
|
21
|
-
return {
|
|
22
|
-
goalRelevance: raw.goal_relevance,
|
|
23
|
-
goalCongruence: raw.goal_congruence,
|
|
24
|
-
expectedness: raw.expectedness,
|
|
25
|
-
controllability: raw.controllability,
|
|
26
|
-
agency: raw.agency,
|
|
27
|
-
normCompatibility: raw.norm_compatibility,
|
|
28
|
-
internalStandards: raw.internal_standards,
|
|
29
|
-
adjustmentPotential: raw.adjustment_potential,
|
|
30
|
-
urgency: raw.urgency,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
4
|
+
import { toWireAppraisal, fromWireAppraisal } from '../shared/appraisal';
|
|
33
5
|
// ---------------------------------------------------------------------------
|
|
34
6
|
// World class (domain)
|
|
35
7
|
// ---------------------------------------------------------------------------
|
|
@@ -180,7 +152,7 @@ export class World {
|
|
|
180
152
|
body: {
|
|
181
153
|
name: options.name,
|
|
182
154
|
description: options.description,
|
|
183
|
-
appraisal_vector:
|
|
155
|
+
appraisal_vector: toWireAppraisal(options.appraisalVector),
|
|
184
156
|
},
|
|
185
157
|
});
|
|
186
158
|
const raw = unwrap(data);
|
|
@@ -195,7 +167,7 @@ export class World {
|
|
|
195
167
|
return (raw.actions ?? []).map((a) => ({
|
|
196
168
|
name: a.name,
|
|
197
169
|
description: a.description,
|
|
198
|
-
appraisalVector:
|
|
170
|
+
appraisalVector: fromWireAppraisal(a.appraisal_vector),
|
|
199
171
|
isDefault: a.is_default,
|
|
200
172
|
}));
|
|
201
173
|
}
|
|
@@ -246,7 +218,7 @@ export class World {
|
|
|
246
218
|
action_name: options.action,
|
|
247
219
|
action_label: options.actionLabel,
|
|
248
220
|
stimulus_description: options.stimulusDescription,
|
|
249
|
-
appraisal_vector: options.appraisal ?
|
|
221
|
+
appraisal_vector: options.appraisal ? toWireAppraisal(options.appraisal) : undefined,
|
|
250
222
|
actor_id: options.actor,
|
|
251
223
|
actor_type: options.actorType,
|
|
252
224
|
},
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* 제공하되, 내부적으로 World API 엔드포인트를 사용한다.
|
|
9
9
|
*/
|
|
10
10
|
import { type ApiClient } from './client';
|
|
11
|
-
import type {
|
|
11
|
+
import type { Appraisal } from './types';
|
|
12
12
|
import type { LLMAdapter } from '../llm/adapter';
|
|
13
13
|
export type LLMMessage = {
|
|
14
14
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -24,18 +24,16 @@ export interface PersonaEmotion {
|
|
|
24
24
|
A: number;
|
|
25
25
|
D: number;
|
|
26
26
|
};
|
|
27
|
-
discrete?: {
|
|
28
|
-
primary: string;
|
|
29
|
-
secondary?: string;
|
|
30
|
-
intensity: number;
|
|
31
|
-
};
|
|
32
27
|
delta?: {
|
|
33
28
|
V: number;
|
|
34
29
|
A: number;
|
|
35
30
|
D: number;
|
|
36
31
|
};
|
|
32
|
+
label: string;
|
|
33
|
+
secondary_label: string | null;
|
|
34
|
+
intensity: number;
|
|
37
35
|
}
|
|
38
|
-
export interface
|
|
36
|
+
export interface WorldPersonaState {
|
|
39
37
|
emotion: PersonaEmotion;
|
|
40
38
|
mood?: {
|
|
41
39
|
vad: {
|
|
@@ -43,9 +41,12 @@ export interface PersonaState {
|
|
|
43
41
|
A: number;
|
|
44
42
|
D: number;
|
|
45
43
|
};
|
|
44
|
+
label: string;
|
|
46
45
|
};
|
|
47
46
|
somatic?: string[];
|
|
48
47
|
}
|
|
48
|
+
/** @deprecated Use {@link WorldPersonaState} instead. */
|
|
49
|
+
export type PersonaState = WorldPersonaState;
|
|
49
50
|
export interface PromptContext {
|
|
50
51
|
systemPrompt: string;
|
|
51
52
|
promptContext: Record<string, string>;
|
|
@@ -67,7 +68,7 @@ export interface PersonaDetail {
|
|
|
67
68
|
goals?: unknown[];
|
|
68
69
|
[key: string]: unknown;
|
|
69
70
|
};
|
|
70
|
-
state:
|
|
71
|
+
state: WorldPersonaState | null;
|
|
71
72
|
}
|
|
72
73
|
export interface ReactOptions {
|
|
73
74
|
/** Who is performing the action (e.g. 'yongjun'). */
|
|
@@ -90,8 +91,9 @@ export interface ReactResult<T = string> {
|
|
|
90
91
|
A: number;
|
|
91
92
|
D: number;
|
|
92
93
|
};
|
|
94
|
+
label: string;
|
|
93
95
|
};
|
|
94
|
-
somatic
|
|
96
|
+
somatic: string[];
|
|
95
97
|
/** LLM-generated narrative — typed T if schema provided, string otherwise. */
|
|
96
98
|
narrative: T;
|
|
97
99
|
}
|
|
@@ -111,7 +113,7 @@ export declare class WorldPersona {
|
|
|
111
113
|
/** Fetch full persona detail (config + state). Cached per-instance. */
|
|
112
114
|
getDetail(): Promise<PersonaDetail>;
|
|
113
115
|
/** Get current emotion/mood/somatic state. */
|
|
114
|
-
getState(): Promise<
|
|
116
|
+
getState(): Promise<WorldPersonaState>;
|
|
115
117
|
/** Get speaking style from persona config (identity.speakingStyle). */
|
|
116
118
|
getSpeakingStyle(): Promise<string | undefined>;
|
|
117
119
|
/** Get LLM system prompt assembled from all persona subsystems + world context. */
|
|
@@ -123,9 +125,11 @@ export declare class WorldPersona {
|
|
|
123
125
|
interact(action: string, options?: {
|
|
124
126
|
actor?: string;
|
|
125
127
|
actorType?: 'user' | 'persona';
|
|
126
|
-
appraisal?:
|
|
128
|
+
appraisal?: Appraisal;
|
|
127
129
|
stimulusDescription?: string;
|
|
128
130
|
}): Promise<{
|
|
131
|
+
action: string;
|
|
132
|
+
target: string;
|
|
129
133
|
emotion: PersonaEmotion;
|
|
130
134
|
mood?: {
|
|
131
135
|
vad: {
|
|
@@ -133,8 +137,9 @@ export declare class WorldPersona {
|
|
|
133
137
|
A: number;
|
|
134
138
|
D: number;
|
|
135
139
|
};
|
|
140
|
+
label: string;
|
|
136
141
|
};
|
|
137
|
-
somatic
|
|
142
|
+
somatic: string[];
|
|
138
143
|
}>;
|
|
139
144
|
/**
|
|
140
145
|
* Advance persona simulation time by the specified number of seconds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world-persona.d.ts","sourceRoot":"","sources":["../../../src/world/world-persona.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"world-persona.d.ts","sourceRoot":"","sources":["../../../src/world/world-persona.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC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CAAC;QACnE,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IA6BF;;;;;;;OAOG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,aAAa,CAAC,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;IAgBnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,KAAK,CAAC,CAAC,GAAG,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CA+C3B"}
|
|
@@ -8,22 +8,7 @@
|
|
|
8
8
|
* 제공하되, 내부적으로 World API 엔드포인트를 사용한다.
|
|
9
9
|
*/
|
|
10
10
|
import { unwrap } from './client';
|
|
11
|
-
|
|
12
|
-
// Internal helpers
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
function toApiAppraisal(v) {
|
|
15
|
-
return {
|
|
16
|
-
goal_relevance: v.goalRelevance,
|
|
17
|
-
goal_congruence: v.goalCongruence,
|
|
18
|
-
expectedness: v.expectedness,
|
|
19
|
-
controllability: v.controllability,
|
|
20
|
-
agency: v.agency,
|
|
21
|
-
norm_compatibility: v.normCompatibility,
|
|
22
|
-
internal_standards: v.internalStandards,
|
|
23
|
-
adjustment_potential: v.adjustmentPotential,
|
|
24
|
-
urgency: v.urgency,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
11
|
+
import { toWireAppraisal } from '../shared/appraisal';
|
|
27
12
|
export class WorldPersona {
|
|
28
13
|
/** @internal — use World.persona() instead. */
|
|
29
14
|
constructor(client, worldId, personaId, options) {
|
|
@@ -59,7 +44,10 @@ export class WorldPersona {
|
|
|
59
44
|
/** Get current emotion/mood/somatic state. */
|
|
60
45
|
async getState() {
|
|
61
46
|
const detail = await this.getDetail();
|
|
62
|
-
return detail.state ?? {
|
|
47
|
+
return detail.state ?? {
|
|
48
|
+
emotion: { vad: { V: 0, A: 0.5, D: 0 }, label: 'calm', secondary_label: null, intensity: 0 },
|
|
49
|
+
somatic: [],
|
|
50
|
+
};
|
|
63
51
|
}
|
|
64
52
|
/** Get speaking style from persona config (identity.speakingStyle). */
|
|
65
53
|
async getSpeakingStyle() {
|
|
@@ -88,7 +76,7 @@ export class WorldPersona {
|
|
|
88
76
|
action_name: action || undefined,
|
|
89
77
|
action_label: action || undefined,
|
|
90
78
|
stimulus_description: options?.stimulusDescription,
|
|
91
|
-
appraisal_vector: options?.appraisal ?
|
|
79
|
+
appraisal_vector: options?.appraisal ? toWireAppraisal(options.appraisal) : undefined,
|
|
92
80
|
actor_id: options?.actor,
|
|
93
81
|
actor_type: options?.actorType,
|
|
94
82
|
},
|