Replace "N -> M (dropped N-M)" with "input=N output=M" to avoid
subtraction in TAG_LOGI arguments. Callers can infer dropped count
if needed.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Function decorator (@InsightIntentFunctionMethod) previously defaulted
to SERVICE_EXTENSION_ABILITY. Change to UI_ABILITY_BACKGROUND so
Function intents dispatch via StartAbilityByCallWithInsightIntent
(background UIAbility call path) instead of StartExtensionAbility.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Config intents from module.json5 may have empty bundleName (developers
omit it, similar to moduleName). ConvertFromConfigIntent sets
functionNamespace = info.bundleName → empty. Old RegisterInsightIntentFunctions
had a fallback using the bundleName parameter, but BatchRegisterInsightIntentFunctions
lacked this. Empty functionNamespace causes FunctionInfo::Validate failure
and KVStore registration silently drops the function.
Add fallback: when functionNamespace is empty and bundleVersionMap has
exactly one entry (single-bundle call from event_mgr), use that entry's
key as the namespace.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Add wantParam.ToString() to the existing entry log so the full
key-value content of the caller's input is visible for diagnosis.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Add per-URI INFO log after parsing the options.uris string array,
showing index and value for each. Helps diagnose Link intent
execution failures where uris mismatch or are empty.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Schema declared flags as "string" and parser used GetStringParam +
ParseInt to convert, requiring callers to pass "256" instead of 256.
Change to "integer" type and use GetIntParam directly, matching the
underlying Want flags bitmask semantics. Remove now-unused AUTO_BASE
constant.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
event_mgr previously called RegisterInsightIntentFunctions which loops
RegisterOrUpdateFunction per FunctionInfo (N IPC calls). Switch to
BatchRegisterInsightIntentFunctions for a single IPC via Ashmem shared
memory, consistent with the boot path.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Config intents from module.json5 may omit moduleName (it's known from
context). Previous backfill ran AFTER SaveInsightIntentTotalInfo, so
RDB stored the original empty moduleName while KVStore registration
got the backfilled value.
At execution time, GetConfigInsightIntentInfoByName reads from RDB
(empty moduleName) → ConvertConfigToGenericInfo copies empty →
FilterGeneric drops the intent → execution fails despite successful
registration.
Move backfill BEFORE SaveInsightIntentTotalInfo so both RDB and
KVStore receive the correct moduleName, keeping registration and
execution consistent.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[0%] 👌 AI Adopted[0%] 🧑 Human[100%]
Change BatchRegisterFunctions IDL from [in] FunctionInfo[] (Parcel,
1MB Binder limit) to [in] FunctionsRawData (shared memory/Ashmem),
matching the existing GetAllFunctions pattern. This allows a single
IPC to carry all functions regardless of data size, eliminating the
N/50 batch chunking that caused repeated CheckKvStore loops on
simulators without a KVStore and led to boot timeouts.
Client-side CliToolMGRClient keeps accepting vector<FunctionInfo>
and converts to FunctionsRawData internally via FromFunctionInfoVec.
Service-side converts back via ToFunctionInfoVec before processing.
Chunking logic in BatchRegisterInsightIntentFunctions is removed.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
These two parameters are system-internal and should not be part of
the function calling contract. Remove them from the registered
options schema so LLM agents don't see them. Parser no longer reads
them from options: userId defaults to INVALID_USER_ID (-1) filled
by CheckAndUpdateParam, displayId defaults to INVALID_DISPLAY_ID
filled by SCB. ResolveUserId/ResolveDisplayId methods and their
constants are deleted.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Function calling previously only accepted Function (SE) and Entry
with BG/SE executeMode. Page (front-end UIAbility page navigation)
and Link (OpenLink deep link) were dropped by FilterGeneric.
Page and Link are valid intent types that downstream ExecuteIntentCommon
already supports (StartAbilityWithInsightIntent for Page routing,
IntentOpenLinkInner for Link). Allow them through FilterGeneric so
LLM agents can trigger page navigation and URI-based deep links.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Add boundary and error logs across the intent→function registration
flow to make it easier to diagnose intents that reach the RDB but
fail to register in the function KVStore.
FilterConfig/FilterGeneric: log input/output counts and WARN on each
dropped intent with intentName, moduleName, and the reason (empty
fields, not BG/SE). RegisterInsightIntentFunctions: log entry counts
and WARN when convert yields zero functions.
event_mgr: log collected intent counts before filter, after filter,
and bundle name at each boundary.
sys_event_receiver: log GetAllInsightIntentInfoForRegister result
counts (intent/config/bundles) after the boot-time filter pass.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
InsightIntentProfile::TransformTo parses moduleName from the config
JSON's optional "moduleName" field. Developers often omit it because
moduleName is known from the module.json5 context. SaveInsightIntentTotalInfo
stores via the external moduleNameLocal parameter, so RDB succeeds, but
downstream ConvertFromConfigIntent and future FilterConfig see an empty
moduleName, causing the intent to either produce an incomplete options
schema or get dropped before reaching the function KVStore.
Backfill moduleNameLocal into each Config intent entry when the JSON
field is absent, ensuring consistent moduleName availability across
registration and execution paths.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Schema default for executeMode is "background" (lowercase), but
ResolveExecuteModeFromOption's MODE_MAP only had enum-full-name keys
("UI_ABILITY_BACKGROUND"). Add lowercase aliases matching both the
schema default and the profile JSON executeMode strings so callers
can pass "background" / "foreground" / "serviceextension" /
"uiextension" directly.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Static analysis flags FilterGeneric at depth 5 (function → for → if
Entry → for mode → if mode==). Pull the Entry executeMode check into
IsQualifiedEntry helper so FilterGeneric stays at depth 4.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Single Binder IPC has a ~1 MB mmap ceiling; a large FunctionInfo
vector (~2KB per entry due to inputSchema) can exceed the safe
threshold at 100+ entries. Split the vector into batches of 50
(~100KB each) and issue one IPC per batch. successCount is
accumulated across batches; any batch failure aborts early.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Unify on Generic (ExtractInsightIntentInfo) as the sole data format
for registration. Drop ConvertFromExtractProfile, FilterProfile, the
PrepareForRegister template, and the three ExtractFrom* helpers. Each
remaining Filter (Config/Generic) now inlines rule-1 filtering and
(moduleName, abilityName) sort directly.
event_mgr now converts Profile→Generic via ProfileInfoFormat before
filtering and registering, matching the sys_event_receiver path.
ConvertFromExtractIntentInfo is completed to emit the same full
FunctionInfo (options schema, inputSchema, outputSchema) that the old
Profile path produced, so both registration paths yield identical
KVStore entries.
Net effect: ~50 lines removed, one conversion path, two self-contained
filters, and consistent FunctionInfo output across all callers.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Remove deviceId from the registered options schema, drop the
ResolveDeviceId parser step (deviceId stays at its default empty
string), and delete the DispatchDistributedIntent helper plus the
distributed branch in ExecuteIntentByFunctionCall. ignoreAbilityName
no longer considers deviceId. The intent now always dispatches
locally via ExecuteIntentCommon.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
ExecuteIntentByFunctionCall grew past 50 lines after adding the want
param cleanup. Pull wantParam cleanup + multi-candidate match +
paramParser.Build into PrepareFunctionCallParam so the entry function
stays focused on permission checks, dispatch routing, and common
handoff. Both functions are now under the 50-line cap.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Mirror StartAbility path which calls InsightIntentExecuteParam::
RemoveInsightIntent to strip residual INSIGHT_INTENT_* keys from the
want before downstream dispatch. Build a temporary Want from the input
WantParams, remove the intent params, then feed the cleaned WantParams
to InsightIntentParamParser::Build so downstream StartAbility*/DMS
paths no longer carry the intent execute metadata.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (unknown) <ai@local>
Add abilityms_cli_tool_function_include config and attach it as a
public_config on the abilityms target. All test targets that depend
on :abilityms now automatically pick up the cli_tool function include
path, removing the need to patch each test's BUILD.gn when
insight_intent_db_cache.cpp (which transitively includes
function_info.h) is compiled into the test.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
ResolveUserId now defaults to -1 (INVALID_USER_ID) instead of
callerUserId, so InsightIntentExecuteManager::CheckAndUpdateParam can
fall back to calling-UID-derived userId exactly like the ExecuteIntent
path. options.userId still overrides.
ExecuteIntentByFunctionCall now honors param->deviceId_: when non-empty
the function dispatches via DispatchDistributedIntent (flood attack
check, PERMISSION_EXECUTE_DISTRIBUTED_INTENT, GenerateWant,
dmsClient.StartRemoteIntent, SetRemoteIntentTimeout) instead of falling
through to ExecuteIntentCommon. ignoreAbilityName also becomes true when
deviceId is set, matching ExecuteIntent's existing behavior.
DispatchDistributedIntent is a new private helper so the distributed
dispatch body stays under the 50-line function cap.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[0%] 👌 AI Adopted[0%] 🧑 Human[100%]
CliToolMgrClient::BatchRegisterFunctions returns ErrCode (int alias).
Use ErrCode instead of int32_t for the local ret variable so the type
matches the API declaration exactly, in line with the rest of the
CliTool client surface.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[0%] 👌 AI Adopted[0%] 🧑 Human[100%]
Rename c/s/rep to candidate/str/matched inside InsightIntentParamParser
helpers and Build. Rename GetAbilityNameFromRep/GetExecuteModeFromRep
to GetAbilityNameFromMatched/GetExecuteModeFromMatched so the helper
names line up with the ParseResult.matchedInfo field they feed.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
sys_event_receiver's RegisterAllFunctions now collects every bundle's
FunctionInfo into one vector and calls CliToolMGRClient::BatchRegisterFunctions
in a single IPC instead of looping RegisterInsightIntentFunctions per
bundle. Cuts N bundle IPCs down to 1 on the boot/shutdown registration
path. New helper BatchRegisterInsightIntentFunctions in function_call_convert
covers convert + version stamping + batch call.
event_mgr path (per-module install) is untouched and still uses
RegisterInsightIntentFunctions. This commit depends on the pending
BatchRegisterFunctions API in cli_tool_framework.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
The field holds the candidate picked by the executor after rule-1
filtering and sort. 'matchedInfo' describes that purpose more directly
than 'representative' (which read as if the candidate were a spokesperson
for some group). Caller in ExecuteIntentByFunctionCall updated.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
IntentParamParser::Build now applies the same rule-1 filter and
(moduleName, abilityName) sort as IntentFilterUtil::FilterGeneric, then
picks the sorted vector's last element as the single representative.
All param fields come from that one representative (moduleName,
abilityName, executeMode, decoratorType), so registration and execution
end up choosing the same candidate for a given (bundleName, intentName).
wantParam.options overridess still apply on top of representative
fields. PickActiveCandidates and per-field Resolve* helpers are removed
since representative selection replaces them. FilterGeneric is reused
rather than duplicating rule-1 logic in the executor.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Rename FilterCandidate to RegisterSortKey (it is a sort key, not a
selection candidate after rules 2+3 were dropped), give it operator<
so the sort comparator reads naturally. Rename FilterAndSort template
to PrepareForRegister to surface the business intent (data prep for
KVStore registration). Replace the index-sort trick with std::pair
(key, item) pairing for a linear read.
No public API change. IntentFilterUtil::FilterProfile/FilterConfig/
FilterGeneric retain their names.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Re-introduce GetAllInsightIntentInfoForRegister on DbCache that returns
rule-1 filtered and (moduleName, abilityName) sorted data. sys_event_receiver
now calls this ForRegister variant and gets ready-to-register data.
RegisterInsightIntentFunctions drops its inline IntentFilterUtil call
back to pure convert+register semantics.
event_mgr (whose data comes from profile file parsing, not DbCache)
does explicit IntentFilterUtil.FilterProfile/FilterConfig before
Register, since it cannot use the ForRegister shortcut. Net effect:
each caller filters at its own data source instead of Register doing
all work, and the original GetAllInsightIntentInfo stays untouched.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Drop GetAllInsightIntentInfoForRegister and ApplyFilterPerBundle from
DbCache; rule 1 filter and (moduleName, abilityName) sort now live
inside RegisterInsightIntentFunctions where they belong as registration
business logic. DbCache reverts to pure CRUD.
Callers simplified: BackupAndScheduleRegister uses raw
GetAllInsightIntentInfo; event_mgr no longer constructs IntentFilterUtil
explicitly. Both paths converge on a single filter point inside
RegisterInsightIntentFunctions, ensuring consistent rule application.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Drop rules 2+3 (cross-module dedup, same-module multi-ability dedup)
from IntentFilterUtil. Each Filter* now does only rule 1 (drop
non-background-UIAbility / non-ServiceExtension) plus a sort by
(moduleName, abilityName). Sort guarantees deterministic KVStore
last-write-wins ordering for duplicate intentNames.
Adjust RegisterInsightIntentFunctions ConvertFrom* call order to
Config -> Profile/Generic so decorator-based intents overwrite
config-based ones on KVStore collisions.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Simplify rule 2 to "moduleName alphabetical first" without entry
preference. Removes entryModuleNames parameter from IntentFilterUtil
ctor, FilterCandidate.isEntryModule field, CandidateOrdering entry
dimension, DbCache GetAllInsightIntentInfoForRegister signature, and
bundleToEntryModules plumbing in sys_event_receiver/event_mgr. Callers
no longer need to extract entry modules from BundleInfo.
Also rename FilterAndDedup overloads to FilterProfile/FilterConfig/
FilterGeneric for explicit data-source semantics.
Co-Authored-By: Agent
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Wrap GetAllInsightIntentInfo + per-bundle IntentFilterUtil into a single
DbCache entry. sys_event_receiver's BackupAndScheduleRegister now reads
already-filtered data, removing the FilterAndDedup call from
RegisterAllFunctions. event_mgr still uses IntentFilterUtil directly
(its data comes from profile files, not DbCache).
Co-Authored-By: Agent
🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%]
Co-authored-by: claude (glm-5.2) <ai@local>
Signed-off-by: RuiChen_01 <chenrui193@huawei.com>