@nimiplatform/sdk 0.21.0 → 0.22.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.
- package/CHANGELOG.md +70 -0
- package/README.md +161 -433
- package/dist/core/ai/embeddings.d.ts +1 -0
- package/dist/core/ai/embeddings.d.ts.map +1 -1
- package/dist/core/ai/embeddings.js +3 -0
- package/dist/core/ai/embeddings.js.map +1 -1
- package/dist/core/app/desktop-open.d.ts +8 -5
- package/dist/core/app/desktop-open.d.ts.map +1 -1
- package/dist/core/app/desktop-open.js +20 -16
- package/dist/core/app/desktop-open.js.map +1 -1
- package/dist/core/app/index.d.ts +4 -2
- package/dist/core/app/index.d.ts.map +1 -1
- package/dist/core/app/index.js +1 -1
- package/dist/core/app/index.js.map +1 -1
- package/dist/core/app/local-app-agent-introduction.d.ts +3 -0
- package/dist/core/app/local-app-agent-introduction.d.ts.map +1 -1
- package/dist/core/app/local-app-agent-introduction.js +35 -5
- package/dist/core/app/local-app-agent-introduction.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-activity-view.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-activity-view.js +4 -2
- package/dist/core/app/local-app-runtime-platform-activity-view.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-activity.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-activity.js +5 -1
- package/dist/core/app/local-app-runtime-platform-activity.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-configure.d.ts +38 -4
- package/dist/core/app/local-app-runtime-platform-configure.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-configure.js +121 -19
- package/dist/core/app/local-app-runtime-platform-configure.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-conversation.d.ts +67 -6
- package/dist/core/app/local-app-runtime-platform-conversation.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-conversation.js +162 -20
- package/dist/core/app/local-app-runtime-platform-conversation.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-conversation.d.ts +4 -1
- package/dist/core/app/local-app-runtime-platform-direct-conversation.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-conversation.js +58 -5
- package/dist/core/app/local-app-runtime-platform-direct-conversation.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-realm-realtime.d.ts +2 -0
- package/dist/core/app/local-app-runtime-platform-direct-realm-realtime.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-direct-realm-realtime.js +10 -2
- package/dist/core/app/local-app-runtime-platform-direct-realm-realtime.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform-life.d.ts +33 -0
- package/dist/core/app/local-app-runtime-platform-life.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-life.js +59 -0
- package/dist/core/app/local-app-runtime-platform-life.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-proactive.d.ts +28 -0
- package/dist/core/app/local-app-runtime-platform-proactive.d.ts.map +1 -0
- package/dist/core/app/local-app-runtime-platform-proactive.js +42 -0
- package/dist/core/app/local-app-runtime-platform-proactive.js.map +1 -0
- package/dist/core/app/local-app-runtime-platform-realm-realtime.d.ts +6 -2
- package/dist/core/app/local-app-runtime-platform-realm-realtime.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform-realm-realtime.js +15 -4
- package/dist/core/app/local-app-runtime-platform-realm-realtime.js.map +1 -1
- package/dist/core/app/local-app-runtime-platform.d.ts +3 -2
- package/dist/core/app/local-app-runtime-platform.d.ts.map +1 -1
- package/dist/core/app/local-app-runtime-platform.js +5 -2
- package/dist/core/app/local-app-runtime-platform.js.map +1 -1
- package/dist/core/app/runtime-account-realm-source-readiness.generated.d.ts +2 -2
- package/dist/core/app/runtime-account-realm-source-readiness.generated.d.ts.map +1 -1
- package/dist/core/app/runtime-account-realm-source-readiness.generated.js +12 -9
- package/dist/core/app/runtime-account-realm-source-readiness.generated.js.map +1 -1
- package/dist/core-generated/realm-client.d.ts.map +1 -1
- package/dist/core-generated/realm-client.js +33 -99
- package/dist/core-generated/realm-client.js.map +1 -1
- package/dist/core-generated/realm-typed-client.d.ts +257 -432
- package/dist/core-generated/realm-typed-client.d.ts.map +1 -1
- package/dist/core-generated/realm-typed-client.js +55 -202
- package/dist/core-generated/realm-typed-client.js.map +1 -1
- package/dist/core-generated/runtime-client.d.ts.map +1 -1
- package/dist/core-generated/runtime-client.js +80 -16
- package/dist/core-generated/runtime-client.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/field_mask.d.ts +16 -18
- package/dist/core-generated/runtime-protobuf/google/protobuf/field_mask.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/field_mask.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/struct.d.ts +33 -22
- package/dist/core-generated/runtime-protobuf/google/protobuf/struct.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/struct.js +8 -3
- package/dist/core-generated/runtime-protobuf/google/protobuf/struct.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/google/protobuf/timestamp.d.ts +3 -3
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.d.ts +10 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.js +9 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/account.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_configure.d.ts +147 -4
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_configure.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_configure.js +327 -14
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_configure.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_life.d.ts +167 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_life.d.ts.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_life.js +312 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_life.js.map +1 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.d.ts +448 -147
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.js +1078 -466
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_service.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_source_materialization.d.ts +5 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_source_materialization.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_source_materialization.js +4 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/agent_source_materialization.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/ai.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.d.ts +712 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.js +1461 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/audit.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.d.ts +92 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.js +204 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/capability_configuration.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/cognition_memory.d.ts +67 -4
- package/dist/core-generated/runtime-protobuf/runtime/v1/cognition_memory.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/cognition_memory.js +101 -10
- package/dist/core-generated/runtime-protobuf/runtime/v1/cognition_memory.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.d.ts +5 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.js +4 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/common.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.d.ts +38 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.js +79 -2
- package/dist/core-generated/runtime-protobuf/runtime/v1/connector.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/realm_realtime.d.ts +181 -8
- package/dist/core-generated/runtime-protobuf/runtime/v1/realm_realtime.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/realm_realtime.js +402 -18
- package/dist/core-generated/runtime-protobuf/runtime/v1/realm_realtime.js.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/runtime_service_control.d.ts +41 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/runtime_service_control.d.ts.map +1 -1
- package/dist/core-generated/runtime-protobuf/runtime/v1/runtime_service_control.js +93 -0
- package/dist/core-generated/runtime-protobuf/runtime/v1/runtime_service_control.js.map +1 -1
- package/dist/core-generated/runtime-public-client.d.ts.map +1 -1
- package/dist/core-generated/runtime-public-client.js +72 -16
- package/dist/core-generated/runtime-public-client.js.map +1 -1
- package/dist/core-generated/runtime-public-rpc-auth-posture.d.ts.map +1 -1
- package/dist/core-generated/runtime-public-rpc-auth-posture.js +9 -2
- package/dist/core-generated/runtime-public-rpc-auth-posture.js.map +1 -1
- package/dist/core-generated/runtime-public-wire-codecs.d.ts +13 -6
- package/dist/core-generated/runtime-public-wire-codecs.d.ts.map +1 -1
- package/dist/core-generated/runtime-public-wire-codecs.js +13 -6
- package/dist/core-generated/runtime-public-wire-codecs.js.map +1 -1
- package/dist/core-generated/runtime-rpc-auth-posture.d.ts.map +1 -1
- package/dist/core-generated/runtime-rpc-auth-posture.js +10 -2
- package/dist/core-generated/runtime-rpc-auth-posture.js.map +1 -1
- package/dist/core-generated/runtime-typed-client.d.ts +26 -16
- package/dist/core-generated/runtime-typed-client.d.ts.map +1 -1
- package/dist/core-generated/runtime-typed-client.js +97 -16
- package/dist/core-generated/runtime-typed-client.js.map +1 -1
- package/dist/core-generated/runtime-wire-codecs.d.ts +15 -7
- package/dist/core-generated/runtime-wire-codecs.d.ts.map +1 -1
- package/dist/core-generated/runtime-wire-codecs.js +16 -8
- package/dist/core-generated/runtime-wire-codecs.js.map +1 -1
- package/dist/realm/account-settings.d.ts +5 -3
- package/dist/realm/account-settings.d.ts.map +1 -1
- package/dist/realm/account-settings.js +3 -3
- package/dist/realm/account-settings.js.map +1 -1
- package/dist/realm/generated.d.ts +1 -1
- package/dist/realm/generated.d.ts.map +1 -1
- package/dist/realm/generated.js.map +1 -1
- package/dist/realm/index.d.ts +4 -4
- package/dist/realm/index.d.ts.map +1 -1
- package/dist/realm/index.js +5 -15
- package/dist/realm/index.js.map +1 -1
- package/dist/realm/media-delivery.d.ts +4 -0
- package/dist/realm/media-delivery.d.ts.map +1 -0
- package/dist/realm/media-delivery.js +65 -0
- package/dist/realm/media-delivery.js.map +1 -0
- package/dist/realm/resource-upload.d.ts +12 -3
- package/dist/realm/resource-upload.d.ts.map +1 -1
- package/dist/realm/resource-upload.js +93 -241
- package/dist/realm/resource-upload.js.map +1 -1
- package/dist/realm/social-types.d.ts +1 -15
- package/dist/realm/social-types.d.ts.map +1 -1
- package/dist/realm/social.d.ts +3 -17
- package/dist/realm/social.d.ts.map +1 -1
- package/dist/realm/social.js +0 -175
- package/dist/realm/social.js.map +1 -1
- package/dist/runtime/config-projections.d.ts +10 -0
- package/dist/runtime/config-projections.d.ts.map +1 -1
- package/dist/runtime/config-projections.js +8 -3
- package/dist/runtime/config-projections.js.map +1 -1
- package/dist/runtime/connector-inventory.d.ts +9 -2
- package/dist/runtime/connector-inventory.d.ts.map +1 -1
- package/dist/runtime/connector-inventory.js +67 -24
- package/dist/runtime/connector-inventory.js.map +1 -1
- package/dist/runtime/desktop-first-party-runtime.d.ts +8 -1
- package/dist/runtime/desktop-first-party-runtime.d.ts.map +1 -1
- package/dist/runtime/desktop-first-party-runtime.js +80 -2
- package/dist/runtime/desktop-first-party-runtime.js.map +1 -1
- package/dist/runtime/first-party-protected-runtime-profiles.generated.d.ts +46 -10
- package/dist/runtime/first-party-protected-runtime-profiles.generated.d.ts.map +1 -1
- package/dist/runtime/first-party-protected-runtime-profiles.generated.js +13 -4
- package/dist/runtime/first-party-protected-runtime-profiles.generated.js.map +1 -1
- package/dist/runtime/generated.d.ts +2 -2
- package/dist/runtime/generated.d.ts.map +1 -1
- package/dist/runtime/generated.js +1 -1
- package/dist/runtime/generated.js.map +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +11 -10
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-grpc.d.ts.map +1 -1
- package/dist/runtime/node-grpc.js +24 -4
- package/dist/runtime/node-grpc.js.map +1 -1
- package/dist/runtime/reason-messages.d.ts +3 -0
- package/dist/runtime/reason-messages.d.ts.map +1 -1
- package/dist/runtime/reason-messages.js +6 -0
- package/dist/runtime/reason-messages.js.map +1 -1
- package/dist/runtime/runtime-agent-inspect-projection.d.ts +2 -3
- package/dist/runtime/runtime-agent-inspect-projection.d.ts.map +1 -1
- package/dist/runtime/runtime-agent-inspect-projection.js +2 -27
- package/dist/runtime/runtime-agent-inspect-projection.js.map +1 -1
- package/dist/runtime/runtime-agent-inspect-types.d.ts +4 -32
- package/dist/runtime/runtime-agent-inspect-types.d.ts.map +1 -1
- package/dist/runtime/runtime-local-environment-client-types.d.ts +6 -1
- package/dist/runtime/runtime-local-environment-client-types.d.ts.map +1 -1
- package/dist/runtime/runtime-local-environment-client.d.ts.map +1 -1
- package/dist/runtime/runtime-local-environment-client.js +20 -2
- package/dist/runtime/runtime-local-environment-client.js.map +1 -1
- package/dist/runtime/runtime-method-modules.d.ts +1 -1
- package/dist/runtime/runtime-method-modules.d.ts.map +1 -1
- package/dist/runtime/runtime-method-modules.js +4 -2
- package/dist/runtime/runtime-method-modules.js.map +1 -1
- package/dist/runtime/wire-types/agent-participation-enums.d.ts +2 -1
- package/dist/runtime/wire-types/agent-participation-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/agent-participation-enums.js +2 -1
- package/dist/runtime/wire-types/agent-participation-enums.js.map +1 -1
- package/dist/runtime/wire-types/agent-participation-types.d.ts +6 -4
- package/dist/runtime/wire-types/agent-participation-types.d.ts.map +1 -1
- package/dist/runtime/wire-types/ai-scenario-enums.d.ts +18 -0
- package/dist/runtime/wire-types/ai-scenario-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/ai-scenario-enums.js +21 -0
- package/dist/runtime/wire-types/ai-scenario-enums.js.map +1 -1
- package/dist/runtime/wire-types/ai-scenario-types.d.ts +4 -4
- package/dist/runtime/wire-types/ai-scenario-types.d.ts.map +1 -1
- package/dist/runtime/wire-types/identity-app-types.d.ts +4 -4
- package/dist/runtime/wire-types/identity-app-types.d.ts.map +1 -1
- package/dist/runtime/wire-types/local-memory-enums.d.ts +9 -0
- package/dist/runtime/wire-types/local-memory-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/local-memory-enums.js +10 -0
- package/dist/runtime/wire-types/local-memory-enums.js.map +1 -1
- package/dist/runtime/wire-types/reason-code-enums.d.ts +2 -1
- package/dist/runtime/wire-types/reason-code-enums.d.ts.map +1 -1
- package/dist/runtime/wire-types/reason-code-enums.js +1 -0
- package/dist/runtime/wire-types/reason-code-enums.js.map +1 -1
- package/dist/types/sha256.d.ts +6 -1
- package/dist/types/sha256.d.ts.map +1 -1
- package/dist/types/sha256.js +60 -25
- package/dist/types/sha256.js.map +1 -1
- package/package.json +3 -3
- package/dist/realm/feed.d.ts +0 -4
- package/dist/realm/feed.d.ts.map +0 -1
- package/dist/realm/feed.js +0 -10
- package/dist/realm/feed.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { projectLife, projectRuntimeLife, validateLifeTimezone } from './local-app-runtime-platform-life.js';
|
|
1
2
|
import { validateCapabilityIntents } from './local-app-runtime-platform-ai-config.js';
|
|
2
3
|
import { Struct as RuntimeStruct } from '../../core-generated/runtime-protobuf/google/protobuf/struct.js';
|
|
3
4
|
import { AIConfigEffectiveState, AgentContextProjectionReasonCode, AgentConversationSummaryStatus, AgentExecutionState, AgentLifecycleStatus, AgentLocalSourceContextState, AgentLocalSourceCoverageSection, AgentLocalSourceCoverageState, AgentPresentationAssetRole, AgentPresentationBackendKind, AgentSourceCognitionStatus, AgentTurnContextLaneId, AgentTurnContextLaneState, AgentTurnContextState, AgentTurnContextTruncationReason, CognitionMemoryEpistemicStatus, CognitionMemoryLifecycle, CognitionMemoryOutcome, LocalAgentCapabilityParticipationRole, LocalAppAgentManagerActionAvailabilityState, LocalAppAgentManagerActionUnavailableReason, LocalAppAgentManagerProductAction, LocalAppAgentAutonomyMode, ReasonCode, } from '../../core-generated/runtime-typed-client.js';
|
|
@@ -70,7 +71,7 @@ const MANAGER_LANE_IDS = new Set([
|
|
|
70
71
|
'runtime_policy', 'output_contract', 'source_identity', 'source_behavior', 'world_context',
|
|
71
72
|
'relationship_context', 'source_knowledge', 'canonical_memory', 'conversation_history',
|
|
72
73
|
'capability_context', 'current_user_turn', 'cognition_source', 'conversation_summary',
|
|
73
|
-
'private_recall', 'app_work',
|
|
74
|
+
'private_recall', 'app_work', 'life_context',
|
|
74
75
|
]);
|
|
75
76
|
const MANAGER_LANE_STATES = new Set([
|
|
76
77
|
'included', 'empty', 'omitted', 'truncated', 'invalid',
|
|
@@ -93,6 +94,12 @@ const MANAGER_CONVERSATION_SUMMARY_STATUSES = new Set([
|
|
|
93
94
|
*/
|
|
94
95
|
export function createNimiLocalAppAgentConfigureRuntimeShell(runtime) {
|
|
95
96
|
return Object.freeze({
|
|
97
|
+
conversationContext: Object.freeze({
|
|
98
|
+
update: async (input) => {
|
|
99
|
+
const wire = requireWireProjection((await runtime.updateLocalAppAgentConversationContext(validateConversationContextInput(input))).projection, 'Conversation context');
|
|
100
|
+
return projectConversationContextUpdate(input, { ...wire, suggestedFirstTurnSequence: wire.suggestedFirstTurnSequence ?? null });
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
96
103
|
manager: Object.freeze({
|
|
97
104
|
snapshot: async (input) => projectRuntimeManagerSnapshot(requireWireProjection((await runtime.getLocalAppAgentManagerSnapshot(input)).snapshot, 'Agent Center manager snapshot')),
|
|
98
105
|
}),
|
|
@@ -184,6 +191,9 @@ export function createNimiLocalAppAgentConfigureClient(shell) {
|
|
|
184
191
|
return projectSharedAIConfigOptions(await shell.sharedAIConfig.listOptions(query));
|
|
185
192
|
},
|
|
186
193
|
}),
|
|
194
|
+
conversationContext: Object.freeze({
|
|
195
|
+
update: async (input) => projectConversationContextUpdate(input, await shell.conversationContext.update(validateConversationContextInput(input))),
|
|
196
|
+
}),
|
|
187
197
|
autonomy: Object.freeze({
|
|
188
198
|
snapshot: async (input) => projectAutonomy(await shell.autonomy.snapshot(agentScopedPayload(input, 'autonomy snapshot'))),
|
|
189
199
|
update: async (input) => {
|
|
@@ -295,6 +305,60 @@ function decimalRevision(value, field, allowZero) {
|
|
|
295
305
|
}
|
|
296
306
|
return value;
|
|
297
307
|
}
|
|
308
|
+
// @nimi-authority: rule.nimi.sdks.feature-clients.conversation-context-selection
|
|
309
|
+
function validateConversationContextInput(input) {
|
|
310
|
+
assertExactKeys(input, ['agentHandle', 'conversationAnchorId', 'expectedContextRevision', 'firstTurnSequence', 'omitSupplementalContext'], 'Conversation context update');
|
|
311
|
+
assertNoAuthorityMaterial(input);
|
|
312
|
+
if (typeof input.conversationAnchorId !== 'string' || !input.conversationAnchorId.trim()
|
|
313
|
+
|| input.conversationAnchorId.trim() !== input.conversationAnchorId || input.conversationAnchorId.length > 512
|
|
314
|
+
|| typeof input.omitSupplementalContext !== 'boolean') {
|
|
315
|
+
return localAppError('Conversation context selection is invalid.', 'SDK_LOCAL_APP_INPUT_INVALID', 'review_context_selection');
|
|
316
|
+
}
|
|
317
|
+
validateAgentHandle(input.agentHandle);
|
|
318
|
+
for (const [value, allowZero] of [[input.expectedContextRevision, false], [input.firstTurnSequence, true]]) {
|
|
319
|
+
decimalRevision(value, 'context selection', allowZero);
|
|
320
|
+
if (value.length > 20 || BigInt(value) > 18446744073709551615n)
|
|
321
|
+
return localAppError('Conversation context selection is out of range.', 'SDK_LOCAL_APP_INPUT_INVALID', 'review_context_selection');
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
agentHandle: input.agentHandle,
|
|
325
|
+
conversationAnchorId: input.conversationAnchorId,
|
|
326
|
+
expectedContextRevision: decimalRevision(input.expectedContextRevision, 'expectedContextRevision', false),
|
|
327
|
+
firstTurnSequence: decimalRevision(input.firstTurnSequence, 'firstTurnSequence', true),
|
|
328
|
+
omitSupplementalContext: input.omitSupplementalContext,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function projectConversationContext(value) {
|
|
332
|
+
const row = asRecord(value);
|
|
333
|
+
assertExactProjectionKeys(row, ['conversationAnchorId', 'contextRevision', 'firstTurnSequence', 'omitSupplementalContext', 'committedTurnCount', 'suggestedFirstTurnSequence', 'busy', 'canUpdate'], 'Conversation context');
|
|
334
|
+
const decimal = (value, positive = false) => {
|
|
335
|
+
if (typeof value !== 'string' || !/^(0|[1-9][0-9]{0,19})$/u.test(value)
|
|
336
|
+
|| BigInt(value) > 18446744073709551615n || (positive && value === '0'))
|
|
337
|
+
return localAppProjectionError('Conversation context sequence or revision');
|
|
338
|
+
return value;
|
|
339
|
+
};
|
|
340
|
+
const first = decimal(row.firstTurnSequence);
|
|
341
|
+
const count = decimal(row.committedTurnCount);
|
|
342
|
+
const suggested = row.suggestedFirstTurnSequence == null ? null : decimal(row.suggestedFirstTurnSequence);
|
|
343
|
+
if (typeof row.conversationAnchorId !== 'string' || !row.conversationAnchorId.trim()
|
|
344
|
+
|| row.conversationAnchorId.trim() !== row.conversationAnchorId || row.conversationAnchorId.length > 512
|
|
345
|
+
|| typeof row.omitSupplementalContext !== 'boolean' || typeof row.busy !== 'boolean' || typeof row.canUpdate !== 'boolean' || (row.busy && row.canUpdate)
|
|
346
|
+
|| BigInt(first) > BigInt(count) || (suggested !== null && (BigInt(suggested) < BigInt(first) || BigInt(suggested) > BigInt(count)))) {
|
|
347
|
+
return localAppProjectionError('Conversation context');
|
|
348
|
+
}
|
|
349
|
+
return Object.freeze({ conversationAnchorId: row.conversationAnchorId, contextRevision: decimal(row.contextRevision, true), firstTurnSequence: first,
|
|
350
|
+
omitSupplementalContext: row.omitSupplementalContext, committedTurnCount: count, suggestedFirstTurnSequence: suggested, busy: row.busy, canUpdate: row.canUpdate });
|
|
351
|
+
}
|
|
352
|
+
function projectConversationContextUpdate(input, value) {
|
|
353
|
+
const projection = projectConversationContext(value);
|
|
354
|
+
if (projection.conversationAnchorId !== input.conversationAnchorId
|
|
355
|
+
|| projection.firstTurnSequence !== input.firstTurnSequence
|
|
356
|
+
|| projection.omitSupplementalContext !== input.omitSupplementalContext
|
|
357
|
+
|| BigInt(projection.contextRevision) <= BigInt(input.expectedContextRevision)) {
|
|
358
|
+
return localAppProjectionError('Conversation context update binding');
|
|
359
|
+
}
|
|
360
|
+
return projection;
|
|
361
|
+
}
|
|
298
362
|
function validateAutonomyIntent(value) {
|
|
299
363
|
const intent = asRecord(value);
|
|
300
364
|
if (!intent)
|
|
@@ -312,17 +376,20 @@ function validateAutonomyIntent(value) {
|
|
|
312
376
|
const config = asRecord(intent.config);
|
|
313
377
|
if (!config)
|
|
314
378
|
return invalidAutonomyIntent('config');
|
|
315
|
-
assertExactKeys(config, ['dailyTokenBudget', '
|
|
316
|
-
const
|
|
379
|
+
assertExactKeys(config, ['dailyTokenBudget', 'maxBackgroundOutputTokens', 'minPlanningInterval', 'suspendUntil', 'mode', 'freeContactEnabled', 'quietHours', 'maxFreeContactsPerDay'], 'local-app autonomy config');
|
|
380
|
+
const minPlanningInterval = optionalSecondsNanos(config.minPlanningInterval, 'minPlanningInterval');
|
|
317
381
|
const suspendUntil = optionalSecondsNanos(config.suspendUntil, 'suspendUntil');
|
|
318
382
|
return Object.freeze({
|
|
319
383
|
...(intent.enabled === undefined ? {} : { enabled: intent.enabled }),
|
|
320
384
|
config: Object.freeze({
|
|
321
385
|
dailyTokenBudget: nonNegativeBudget(config.dailyTokenBudget, 'dailyTokenBudget'),
|
|
322
|
-
|
|
323
|
-
...(
|
|
386
|
+
maxBackgroundOutputTokens: nonNegativeBudget(config.maxBackgroundOutputTokens, 'maxBackgroundOutputTokens'),
|
|
387
|
+
...(minPlanningInterval === undefined ? {} : { minPlanningInterval }),
|
|
324
388
|
...(suspendUntil === undefined ? {} : { suspendUntil }),
|
|
325
389
|
mode: autonomyMode(config.mode),
|
|
390
|
+
freeContactEnabled: typeof config.freeContactEnabled === 'boolean' ? config.freeContactEnabled : invalidAutonomyIntent('freeContactEnabled'),
|
|
391
|
+
quietHours: projectQuietHours(config.quietHours),
|
|
392
|
+
maxFreeContactsPerDay: freeContactLimit(config.maxFreeContactsPerDay, config.freeContactEnabled),
|
|
326
393
|
}),
|
|
327
394
|
});
|
|
328
395
|
}
|
|
@@ -662,10 +729,13 @@ function projectRuntimeAutonomyMode(value) {
|
|
|
662
729
|
function runtimeAutonomyConfig(config) {
|
|
663
730
|
return {
|
|
664
731
|
dailyTokenBudget: String(config.dailyTokenBudget),
|
|
665
|
-
|
|
666
|
-
...(config.
|
|
732
|
+
maxBackgroundOutputTokens: String(config.maxBackgroundOutputTokens),
|
|
733
|
+
...(config.minPlanningInterval ? { minPlanningInterval: config.minPlanningInterval } : {}),
|
|
667
734
|
...(config.suspendUntil ? { suspendUntil: config.suspendUntil } : {}),
|
|
668
735
|
mode: runtimeAutonomyMode(config.mode),
|
|
736
|
+
freeContactEnabled: config.freeContactEnabled,
|
|
737
|
+
quietHours: config.quietHours ?? undefined,
|
|
738
|
+
maxFreeContactsPerDay: config.maxFreeContactsPerDay,
|
|
669
739
|
};
|
|
670
740
|
}
|
|
671
741
|
function projectRuntimeAutonomy(projection) {
|
|
@@ -673,10 +743,13 @@ function projectRuntimeAutonomy(projection) {
|
|
|
673
743
|
enabled: projection.enabled,
|
|
674
744
|
config: projection.config ? {
|
|
675
745
|
dailyTokenBudget: runtimeSafeInteger(projection.config.dailyTokenBudget, 'agent autonomy dailyTokenBudget'),
|
|
676
|
-
|
|
677
|
-
|
|
746
|
+
maxBackgroundOutputTokens: runtimeSafeInteger(projection.config.maxBackgroundOutputTokens, 'agent autonomy maxBackgroundOutputTokens'),
|
|
747
|
+
minPlanningInterval: runtimeTimestamp(projection.config.minPlanningInterval),
|
|
678
748
|
suspendUntil: runtimeTimestamp(projection.config.suspendUntil),
|
|
679
749
|
mode: projectRuntimeAutonomyMode(projection.config.mode),
|
|
750
|
+
freeContactEnabled: projection.config.freeContactEnabled,
|
|
751
|
+
quietHours: projection.config.quietHours ?? null,
|
|
752
|
+
maxFreeContactsPerDay: projection.config.maxFreeContactsPerDay,
|
|
680
753
|
} : null,
|
|
681
754
|
usedTokensInWindow: runtimeSafeInteger(projection.usedTokensInWindow, 'agent autonomy usedTokensInWindow'),
|
|
682
755
|
windowStartedAt: runtimeTimestamp(projection.windowStartedAt),
|
|
@@ -930,6 +1003,7 @@ function projectRuntimeManagerLaneId(value) {
|
|
|
930
1003
|
[AgentTurnContextLaneId.CONVERSATION_SUMMARY]: 'conversation_summary',
|
|
931
1004
|
[AgentTurnContextLaneId.PRIVATE_RECALL]: 'private_recall',
|
|
932
1005
|
[AgentTurnContextLaneId.APP_WORK]: 'app_work',
|
|
1006
|
+
[AgentTurnContextLaneId.LIFE_CONTEXT]: 'life_context',
|
|
933
1007
|
};
|
|
934
1008
|
return names[value] ?? localAppProjectionError('Agent Center manager lane id');
|
|
935
1009
|
}
|
|
@@ -1034,6 +1108,7 @@ function projectRuntimeManagerActionAvailability(values) {
|
|
|
1034
1108
|
}
|
|
1035
1109
|
function projectRuntimeManagerSnapshot(snapshot) {
|
|
1036
1110
|
return {
|
|
1111
|
+
life: projectRuntimeLife(snapshot.life),
|
|
1037
1112
|
lifecycleStatus: projectRuntimeManagerLifecycle(snapshot.lifecycleStatus),
|
|
1038
1113
|
executionState: projectRuntimeManagerExecution(snapshot.executionState),
|
|
1039
1114
|
statusText: snapshot.statusText,
|
|
@@ -1086,6 +1161,7 @@ function projectRuntimeManagerSnapshot(snapshot) {
|
|
|
1086
1161
|
privateRecallCount: snapshot.context.privateRecallCount,
|
|
1087
1162
|
} : null,
|
|
1088
1163
|
actionAvailability: projectRuntimeManagerActionAvailability(snapshot.actionAvailability),
|
|
1164
|
+
conversationContext: snapshot.conversationContext ? { ...snapshot.conversationContext, suggestedFirstTurnSequence: snapshot.conversationContext.suggestedFirstTurnSequence ?? null } : null,
|
|
1089
1165
|
};
|
|
1090
1166
|
}
|
|
1091
1167
|
function projectSharedAIConfig(value) {
|
|
@@ -1335,15 +1411,17 @@ function projectAutonomy(value) {
|
|
|
1335
1411
|
}
|
|
1336
1412
|
function projectManagerSnapshot(value) {
|
|
1337
1413
|
const projection = asRecord(value);
|
|
1338
|
-
assertExactProjectionKeys(projection, ['lifecycleStatus', 'executionState', 'statusText', 'currentEmotion', 'source', 'context', 'actionAvailability'], 'Agent Center manager snapshot');
|
|
1414
|
+
assertExactProjectionKeys(projection, ['lifecycleStatus', 'executionState', 'statusText', 'currentEmotion', 'source', 'context', 'actionAvailability', 'life', ...(projection && Object.hasOwn(projection, 'conversationContext') ? ['conversationContext'] : [])], 'Agent Center manager snapshot');
|
|
1339
1415
|
assertSafeProjection(projection);
|
|
1340
1416
|
return Object.freeze({
|
|
1417
|
+
life: projectLife(projection.life),
|
|
1341
1418
|
lifecycleStatus: managerEnum(projection.lifecycleStatus, MANAGER_LIFECYCLE_STATUSES, 'Agent Center manager lifecycleStatus'),
|
|
1342
1419
|
executionState: managerEnum(projection.executionState, MANAGER_EXECUTION_STATES, 'Agent Center manager executionState'),
|
|
1343
1420
|
statusText: managerText(projection.statusText, 'Agent Center manager statusText'),
|
|
1344
1421
|
currentEmotion: managerText(projection.currentEmotion, 'Agent Center manager currentEmotion'),
|
|
1345
1422
|
source: projectManagerSource(projection.source),
|
|
1346
1423
|
context: projectManagerContext(projection.context),
|
|
1424
|
+
conversationContext: projection.conversationContext == null ? null : projectConversationContext(projection.conversationContext),
|
|
1347
1425
|
actionAvailability: projectManagerActionAvailability(projection.actionAvailability),
|
|
1348
1426
|
});
|
|
1349
1427
|
}
|
|
@@ -1497,8 +1575,12 @@ function projectManagerContext(value) {
|
|
|
1497
1575
|
});
|
|
1498
1576
|
const inputBudgetTokens = managerUint64(context.inputBudgetTokens, 'Agent Center manager context inputBudgetTokens');
|
|
1499
1577
|
const usedTokens = managerUint64(context.usedTokens, 'Agent Center manager context usedTokens');
|
|
1500
|
-
|
|
1578
|
+
// A rejected composition retains its actual mandatory-token demand so the
|
|
1579
|
+
// owner can explain the failure and let the user repair the model settings.
|
|
1580
|
+
const capacityExceeded = state === 'context_capacity_exceeded' && reasonCode === 'context_capacity_exceeded';
|
|
1581
|
+
if (BigInt(usedTokens) > BigInt(inputBudgetTokens) && !capacityExceeded) {
|
|
1501
1582
|
localAppProjectionError('Agent Center manager context token usage');
|
|
1583
|
+
}
|
|
1502
1584
|
return Object.freeze({
|
|
1503
1585
|
ready: context.ready,
|
|
1504
1586
|
state,
|
|
@@ -1609,7 +1691,10 @@ function projectMemoryMutation(value) {
|
|
|
1609
1691
|
return localAppProjectionError('agent Memory mutation affected ids');
|
|
1610
1692
|
}
|
|
1611
1693
|
const projection = projectMemoryProjection(result.projection);
|
|
1612
|
-
if (result.outcome
|
|
1694
|
+
if (result.outcome === 'rejected' && result.affectedMemoryIds.length !== 0) {
|
|
1695
|
+
return localAppProjectionError('rejected Memory mutation affected ids');
|
|
1696
|
+
}
|
|
1697
|
+
if (result.outcome !== projection.outcome && !['committed', 'admitted', 'forgotten', 'deleted', 'no_effect', 'rejected'].includes(String(result.outcome))) {
|
|
1613
1698
|
return localAppProjectionError('agent Memory mutation outcome');
|
|
1614
1699
|
}
|
|
1615
1700
|
return Object.freeze({ outcome: result.outcome, affectedMemoryIds: Object.freeze([...result.affectedMemoryIds]), projection });
|
|
@@ -1618,27 +1703,30 @@ function projectAutonomyConfig(value) {
|
|
|
1618
1703
|
if (value === null)
|
|
1619
1704
|
return null;
|
|
1620
1705
|
const record = asRecord(value);
|
|
1621
|
-
assertExactProjectionKeys(record, ['dailyTokenBudget', '
|
|
1706
|
+
assertExactProjectionKeys(record, ['dailyTokenBudget', 'maxBackgroundOutputTokens', 'minPlanningInterval', 'suspendUntil', 'mode', 'freeContactEnabled', 'quietHours', 'maxFreeContactsPerDay'], 'agent autonomy config');
|
|
1622
1707
|
if (typeof record.dailyTokenBudget !== 'number'
|
|
1623
1708
|
|| !Number.isSafeInteger(record.dailyTokenBudget)
|
|
1624
1709
|
|| record.dailyTokenBudget < 0
|
|
1625
|
-
|| typeof record.
|
|
1626
|
-
|| !Number.isSafeInteger(record.
|
|
1627
|
-
|| record.
|
|
1710
|
+
|| typeof record.maxBackgroundOutputTokens !== 'number'
|
|
1711
|
+
|| !Number.isSafeInteger(record.maxBackgroundOutputTokens)
|
|
1712
|
+
|| record.maxBackgroundOutputTokens < 0) {
|
|
1628
1713
|
localAppProjectionError('agent autonomy config budgets');
|
|
1629
1714
|
}
|
|
1630
1715
|
const mode = record.mode;
|
|
1631
1716
|
if (typeof mode !== 'string' || !AUTONOMY_MODES.has(mode)) {
|
|
1632
1717
|
localAppProjectionError('agent autonomy mode');
|
|
1633
1718
|
}
|
|
1634
|
-
const
|
|
1719
|
+
const minPlanningInterval = projectTimestamp(record.minPlanningInterval, 'agent autonomy minPlanningInterval');
|
|
1635
1720
|
const suspendUntil = projectTimestamp(record.suspendUntil, 'agent autonomy config suspendUntil');
|
|
1636
1721
|
return Object.freeze({
|
|
1637
1722
|
dailyTokenBudget: record.dailyTokenBudget,
|
|
1638
|
-
|
|
1639
|
-
...(
|
|
1723
|
+
maxBackgroundOutputTokens: record.maxBackgroundOutputTokens,
|
|
1724
|
+
...(minPlanningInterval === undefined ? {} : { minPlanningInterval }),
|
|
1640
1725
|
...(suspendUntil === undefined ? {} : { suspendUntil }),
|
|
1641
1726
|
mode: mode,
|
|
1727
|
+
freeContactEnabled: typeof record.freeContactEnabled === 'boolean' ? record.freeContactEnabled : localAppProjectionError('free contact state'),
|
|
1728
|
+
quietHours: projectQuietHours(record.quietHours),
|
|
1729
|
+
maxFreeContactsPerDay: freeContactLimit(record.maxFreeContactsPerDay, record.freeContactEnabled),
|
|
1642
1730
|
});
|
|
1643
1731
|
}
|
|
1644
1732
|
function projectPresentation(value) {
|
|
@@ -1807,4 +1895,18 @@ function projectedRevision(value, field) {
|
|
|
1807
1895
|
}
|
|
1808
1896
|
return value;
|
|
1809
1897
|
}
|
|
1898
|
+
function projectQuietHours(value) {
|
|
1899
|
+
if (value === null)
|
|
1900
|
+
return null;
|
|
1901
|
+
const row = asRecord(value);
|
|
1902
|
+
assertExactProjectionKeys(row, ['timezone', 'startMinute', 'endMinute'], 'quiet hours');
|
|
1903
|
+
if (typeof row.startMinute !== 'number' || typeof row.endMinute !== 'number' || !Number.isInteger(row.startMinute) || !Number.isInteger(row.endMinute) || row.startMinute < 0 || row.startMinute >= 1440 || row.endMinute < 0 || row.endMinute >= 1440 || row.startMinute === row.endMinute)
|
|
1904
|
+
return localAppProjectionError('quiet hours interval');
|
|
1905
|
+
return Object.freeze({ timezone: validateLifeTimezone(row.timezone), startMinute: row.startMinute, endMinute: row.endMinute });
|
|
1906
|
+
}
|
|
1907
|
+
function freeContactLimit(value, enabled) {
|
|
1908
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 0 || value > 24 || (enabled === true && value === 0))
|
|
1909
|
+
return localAppProjectionError('free contact limit');
|
|
1910
|
+
return value;
|
|
1911
|
+
}
|
|
1810
1912
|
//# sourceMappingURL=local-app-runtime-platform-configure.js.map
|