Skip to content

Commit df70444

Browse files
author
Shaw
committed
patch llama
1 parent 37a63b4 commit df70444

3 files changed

Lines changed: 19 additions & 89 deletions

File tree

packages/app-core/patches/llama-cpp-capacitor@0.1.5.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ index 0000000..0000001 100644
112112

113113
// Chat and completion
114114
CAPPluginMethod(name: "getFormattedChat", returnType: CAPPluginReturnPromise),
115-
@@ -76,6 +80,57 @@ public class LlamaCppPlugin: CAPPlugin, CAPBridgedPlugin {
115+
@@ -76,6 +80,74 @@ public class LlamaCppPlugin: CAPPlugin, CAPBridgedPlugin {
116116

117117
private let implementation = LlamaCpp()
118118

plugins/plugin-form/src/index.ts

Lines changed: 11 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,8 @@ import type { IAgentRuntime, Plugin, ServiceClass } from "@elizaos/core";
1111
import { formRestoreAction } from "./actions/restore";
1212
import { formEvaluator } from "./evaluators/extractor";
1313

14-
// ============================================================================
15-
// TYPE EXPORTS
16-
// ============================================================================
17-
18-
// Types - all interfaces and type definitions
1914
export * from "./types";
2015

21-
// ============================================================================
22-
// BUILT-IN TYPES EXPORTS
23-
// Pre-registered control types (text, number, email, etc.)
24-
// ============================================================================
25-
2616
export {
2717
BUILTIN_TYPE_MAP,
2818
BUILTIN_TYPES,
@@ -31,11 +21,6 @@ export {
3121
registerBuiltinTypes,
3222
} from "./builtins";
3323

34-
// ============================================================================
35-
// VALIDATION EXPORTS
36-
// Field validation, type coercion, and custom type registration
37-
// ============================================================================
38-
3924
export {
4025
clearTypeHandlers,
4126
formatValue,
@@ -46,23 +31,6 @@ export {
4631
validateField,
4732
} from "./validation";
4833

49-
// ============================================================================
50-
// INTENT DETECTION EXPORTS
51-
// Two-tier intent detection (fast path + LLM fallback)
52-
// ============================================================================
53-
54-
export {
55-
hasDataToExtract,
56-
isLifecycleIntent,
57-
isUXIntent,
58-
quickIntentDetect,
59-
} from "./intent";
60-
61-
// ============================================================================
62-
// STORAGE EXPORTS
63-
// Component-based persistence for sessions, submissions, autofill
64-
// ============================================================================
65-
6634
export {
6735
deleteSession,
6836
getActiveSession,
@@ -75,22 +43,15 @@ export {
7543
saveSubmission,
7644
} from "./storage";
7745

78-
// ============================================================================
79-
// EXTRACTION EXPORTS
80-
// LLM-based field extraction from natural language
81-
// ============================================================================
82-
8346
export {
47+
buildFormExtractorPromptSection,
48+
buildFormExtractorSchema,
49+
coerceExtractionsAgainstControls,
8450
detectCorrection,
8551
extractSingleField,
86-
llmIntentAndExtract,
52+
parseFormExtractorOutput,
8753
} from "./extraction";
8854

89-
// ============================================================================
90-
// TTL & EFFORT EXPORTS
91-
// Smart retention based on user effort
92-
// ============================================================================
93-
9455
export {
9556
calculateTTL,
9657
formatEffort,
@@ -101,45 +62,16 @@ export {
10162
shouldNudge,
10263
} from "./ttl";
10364

104-
// ============================================================================
105-
// DEFAULTS EXPORTS
106-
// Sensible default value application
107-
// ============================================================================
108-
10965
export { applyControlDefaults, applyFormDefaults, prettify } from "./defaults";
11066

111-
// ============================================================================
112-
// BUILDER API EXPORTS
113-
// Fluent API for defining forms and controls
114-
// ============================================================================
115-
11667
export { C, ControlBuilder, Form, FormBuilder } from "./builder";
11768

118-
// ============================================================================
119-
// SERVICE EXPORT
120-
// Central form management service
121-
// ============================================================================
122-
12369
export { FormService } from "./service";
12470

125-
// ============================================================================
126-
// COMPONENT EXPORTS
127-
// Provider, Action, Tasks
128-
// ============================================================================
129-
130-
// Action - fast-path restore for stashed forms
13171
export { formRestoreAction } from "./actions/restore";
132-
133-
// Post-message hook - extracts fields and handles intents
134-
// (Action with mode: ActionMode.ALWAYS_AFTER)
13572
export { formEvaluator } from "./evaluators/extractor";
136-
// Provider - injects form context into agent state
13773
export { formContextProvider } from "./providers/context";
13874

139-
// ============================================================================
140-
// PLUGIN DEFINITION
141-
// ============================================================================
142-
14375
/**
14476
* Form Plugin
14577
*
@@ -150,11 +82,12 @@ export const formPlugin = {
15082
description: "Agent-native conversational forms for data collection",
15183
descriptionCompressed: "Conversational forms for structured data collection.",
15284

153-
// Self-declared auto-enable: activate when features.form is enabled.
15485
autoEnable: {
155-
shouldEnable: (_env: Record<string, string | undefined>, config: Record<string, unknown>) => {
156-
const f = (config?.features as Record<string, unknown> | undefined)
157-
?.form;
86+
shouldEnable: (
87+
_env: Record<string, string | undefined>,
88+
config: Record<string, unknown>,
89+
) => {
90+
const f = (config?.features as Record<string, unknown> | undefined)?.form;
15891
return (
15992
f === true ||
16093
(typeof f === "object" &&
@@ -164,7 +97,6 @@ export const formPlugin = {
16497
},
16598
},
16699

167-
// Service for form management
168100
services: [
169101
{
170102
serviceType: "FORM",
@@ -175,7 +107,6 @@ export const formPlugin = {
175107
} as ServiceClass,
176108
],
177109

178-
// Provider for form context
179110
providers: [
180111
{
181112
name: "FORM_CONTEXT",
@@ -188,9 +119,8 @@ export const formPlugin = {
188119
},
189120
],
190121

191-
// Action for restoring stashed forms before normal reply generation,
192-
// plus the form-extraction post-message hook (mode: ALWAYS_AFTER).
193-
actions: [formRestoreAction, formEvaluator],
122+
actions: [formRestoreAction],
123+
evaluators: [formEvaluator],
194124
} as Plugin & { descriptionCompressed?: string };
195125

196126
export default formPlugin;

plugins/plugin-form/test/form-plugin.live.e2e.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ describeIf(LIVE)("Plugin-Form: Plugin e2e", () => {
7272
expect(typeof mod.deleteSession).toBe("function");
7373
});
7474

75-
it("intent detection functions work", async () => {
75+
it("form evaluator exposes schema and prompt helpers", async () => {
7676
const mod = await import("@elizaos/plugin-form");
77-
if (!mod.quickIntentDetect) {
78-
return;
79-
}
80-
// Quick intent detect should handle basic strings
81-
const result = mod.quickIntentDetect("I want to fill out a form");
82-
expect(result).toBeDefined();
77+
const schema = mod.buildFormExtractorSchema();
78+
expect(schema).toBeTruthy();
79+
expect((schema as { type?: string }).type).toBe("object");
80+
expect(typeof mod.formEvaluator.shouldRun).toBe("function");
81+
expect(typeof mod.formEvaluator.prompt).toBe("function");
82+
expect(Array.isArray(mod.formEvaluator.processors)).toBe(true);
8383
});
8484
});

0 commit comments

Comments
 (0)