happy2 0.0.12 → 0.0.14
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/package.json +2 -2
- package/packages/happy2-server/PLUGINS.md +281 -39
- package/packages/happy2-server/README.md +8 -7
- package/packages/happy2-server/dist/index.d.ts +3 -1
- package/packages/happy2-server/dist/index.d.ts.map +1 -1
- package/packages/happy2-server/dist/index.js +2 -0
- package/packages/happy2-server/dist/index.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentChatBind.d.ts +1 -0
- package/packages/happy2-server/dist/modules/agent/agentChatBind.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentChatBind.js +4 -0
- package/packages/happy2-server/dist/modules/agent/agentChatBind.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentChatGetContext.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentChatGetContext.js +3 -1
- package/packages/happy2-server/dist/modules/agent/agentChatGetContext.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentCreate.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentCreate.js +1 -0
- package/packages/happy2-server/dist/modules/agent/agentCreate.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.d.ts +4 -2
- package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.js +8 -8
- package/packages/happy2-server/dist/modules/agent/agentEffortBindingList.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.d.ts +3 -3
- package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.js +4 -4
- package/packages/happy2-server/dist/modules/agent/agentEffortGetContext.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.d.ts +4 -4
- package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.js +57 -41
- package/packages/happy2-server/dist/modules/agent/agentEffortUpdate.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentImageCommitChange.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageCreate.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageCreate.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentImageCreate.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageGet.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageGet.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentImageGet.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.d.ts +2 -1
- package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.js +11 -4
- package/packages/happy2-server/dist/modules/agent/agentImageGetChangeContext.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageList.d.ts +2 -2
- package/packages/happy2-server/dist/modules/agent/agentImageList.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageList.js +8 -4
- package/packages/happy2-server/dist/modules/agent/agentImageList.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentImageRequestBuild.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentImageSetDefault.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentDelete.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentSecretAssignmentList.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentSecretAttachToAgent.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentSecretAttachToChannel.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.d.ts +4 -3
- package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.js +5 -5
- package/packages/happy2-server/dist/modules/agent/agentSecretAuthorizeManagement.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromAgent.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.d.ts +2 -2
- package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.js +4 -4
- package/packages/happy2-server/dist/modules/agent/agentSecretDetachFromChannel.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.d.ts +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.js +3 -3
- package/packages/happy2-server/dist/modules/agent/agentSecretRecordRegistration.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.d.ts +4 -0
- package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.js +15 -0
- package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.js.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.test.js +17 -0
- package/packages/happy2-server/dist/modules/agent/agentSkillHomeGet.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnGetPluginContext.d.ts +23 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnGetPluginContext.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnGetPluginContext.js +70 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnGetPluginContext.js.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.d.ts +4 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.js +207 -9
- package/packages/happy2-server/dist/modules/agent/agentTurnStreamReply.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.d.ts +8 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.js +86 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnTraceGet.js.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.d.ts +19 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.js +87 -0
- package/packages/happy2-server/dist/modules/agent/agentTurnTraceStart.js.map +1 -0
- package/packages/happy2-server/dist/modules/agent/impl/agentChatContext.d.ts +2 -1
- package/packages/happy2-server/dist/modules/agent/impl/agentChatContext.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/impl/agentEffortContext.d.ts +4 -1
- package/packages/happy2-server/dist/modules/agent/impl/agentEffortContext.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.d.ts +3 -3
- package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.js +26 -40
- package/packages/happy2-server/dist/modules/agent/impl/agentEffortContextDb.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.js +63 -2
- package/packages/happy2-server/dist/modules/agent/impl/finishAgentTurn.js.map +1 -1
- package/packages/happy2-server/dist/modules/agent/types.d.ts +53 -0
- package/packages/happy2-server/dist/modules/agent/types.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agents/daemon.d.ts +31 -2
- package/packages/happy2-server/dist/modules/agents/daemon.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agents/daemon.js +12 -2
- package/packages/happy2-server/dist/modules/agents/daemon.js.map +1 -1
- package/packages/happy2-server/dist/modules/agents/service.d.ts +11 -6
- package/packages/happy2-server/dist/modules/agents/service.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/agents/service.js +498 -50
- package/packages/happy2-server/dist/modules/agents/service.js.map +1 -1
- package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.d.ts +12 -0
- package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.js +27 -0
- package/packages/happy2-server/dist/modules/auth/developmentTokenCreate.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.d.ts +8 -0
- package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.js +22 -0
- package/packages/happy2-server/dist/modules/auth/developmentTokenFindActive.js.map +1 -0
- package/packages/happy2-server/dist/modules/auth/methods.d.ts +1 -0
- package/packages/happy2-server/dist/modules/auth/methods.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/auth/methods.js +10 -6
- package/packages/happy2-server/dist/modules/auth/methods.js.map +1 -1
- package/packages/happy2-server/dist/modules/auth/service.d.ts +2 -0
- package/packages/happy2-server/dist/modules/auth/service.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/auth/service.js +26 -0
- package/packages/happy2-server/dist/modules/auth/service.js.map +1 -1
- package/packages/happy2-server/dist/modules/auth/tokens.d.ts +21 -0
- package/packages/happy2-server/dist/modules/auth/tokens.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/auth/tokens.js +97 -3
- package/packages/happy2-server/dist/modules/auth/tokens.js.map +1 -1
- package/packages/happy2-server/dist/modules/auth/tokens.test.js +77 -0
- package/packages/happy2-server/dist/modules/auth/tokens.test.js.map +1 -1
- package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.d.ts +17 -0
- package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.js +98 -0
- package/packages/happy2-server/dist/modules/chat/asAgentTurnTrace.js.map +1 -0
- package/packages/happy2-server/dist/modules/chat/asServiceMessage.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/chat/asServiceMessage.js +13 -5
- package/packages/happy2-server/dist/modules/chat/asServiceMessage.js.map +1 -1
- package/packages/happy2-server/dist/modules/chat/channelCreateWithMembers.d.ts +19 -0
- package/packages/happy2-server/dist/modules/chat/channelCreateWithMembers.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/chat/channelCreateWithMembers.js +87 -0
- package/packages/happy2-server/dist/modules/chat/channelCreateWithMembers.js.map +1 -0
- package/packages/happy2-server/dist/modules/chat/channelMembersUpdate.d.ts +15 -0
- package/packages/happy2-server/dist/modules/chat/channelMembersUpdate.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/chat/channelMembersUpdate.js +38 -0
- package/packages/happy2-server/dist/modules/chat/channelMembersUpdate.js.map +1 -0
- package/packages/happy2-server/dist/modules/chat/chatAppendAudit.d.ts +1 -1
- package/packages/happy2-server/dist/modules/chat/chatAppendAudit.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.d.ts +20 -0
- package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.js +38 -0
- package/packages/happy2-server/dist/modules/chat/chatUpdateMetadata.js.map +1 -0
- package/packages/happy2-server/dist/modules/chat/types.d.ts +6 -0
- package/packages/happy2-server/dist/modules/chat/types.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/chat/types.js.map +1 -1
- package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.d.ts +7 -0
- package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.js +19 -0
- package/packages/happy2-server/dist/modules/chat/userRequireActiveHuman.js.map +1 -0
- package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.d.ts +2 -2
- package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.js +8 -5
- package/packages/happy2-server/dist/modules/chat/userRequireServerAdmin.js.map +1 -1
- package/packages/happy2-server/dist/modules/config/defaults.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/config/defaults.js +1 -0
- package/packages/happy2-server/dist/modules/config/defaults.js.map +1 -1
- package/packages/happy2-server/dist/modules/config/defaults.test.js +1 -0
- package/packages/happy2-server/dist/modules/config/defaults.test.js.map +1 -1
- package/packages/happy2-server/dist/modules/config/loader.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/config/loader.js +4 -0
- package/packages/happy2-server/dist/modules/config/loader.js.map +1 -1
- package/packages/happy2-server/dist/modules/config/loader.test.js +12 -0
- package/packages/happy2-server/dist/modules/config/loader.test.js.map +1 -1
- package/packages/happy2-server/dist/modules/config/type.d.ts +3 -0
- package/packages/happy2-server/dist/modules/config/type.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/message/messageGetProjection.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/message/messageGetProjection.js +28 -0
- package/packages/happy2-server/dist/modules/message/messageGetProjection.js.map +1 -1
- package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.d.ts +4 -0
- package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.js +39 -0
- package/packages/happy2-server/dist/modules/permission/impl/permissionEffectiveDb.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.d.ts +10 -0
- package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.js +31 -0
- package/packages/happy2-server/dist/modules/permission/impl/permissionMutationRecord.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/permissionGetEffective.d.ts +8 -0
- package/packages/happy2-server/dist/modules/permission/permissionGetEffective.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/permissionGetEffective.js +13 -0
- package/packages/happy2-server/dist/modules/permission/permissionGetEffective.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/roleCreate.d.ts +16 -0
- package/packages/happy2-server/dist/modules/permission/roleCreate.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/roleCreate.js +70 -0
- package/packages/happy2-server/dist/modules/permission/roleCreate.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/roleDelete.d.ts +11 -0
- package/packages/happy2-server/dist/modules/permission/roleDelete.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/roleDelete.js +41 -0
- package/packages/happy2-server/dist/modules/permission/roleDelete.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/roleList.d.ts +8 -0
- package/packages/happy2-server/dist/modules/permission/roleList.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/roleList.js +36 -0
- package/packages/happy2-server/dist/modules/permission/roleList.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/roleUpdate.d.ts +14 -0
- package/packages/happy2-server/dist/modules/permission/roleUpdate.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/roleUpdate.js +78 -0
- package/packages/happy2-server/dist/modules/permission/roleUpdate.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/types.d.ts +24 -0
- package/packages/happy2-server/dist/modules/permission/types.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/types.js +10 -0
- package/packages/happy2-server/dist/modules/permission/types.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userPermissionGet.d.ts +16 -0
- package/packages/happy2-server/dist/modules/permission/userPermissionGet.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userPermissionGet.js +33 -0
- package/packages/happy2-server/dist/modules/permission/userPermissionGet.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.d.ts +12 -0
- package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.js +44 -0
- package/packages/happy2-server/dist/modules/permission/userPermissionUpdate.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.d.ts +8 -0
- package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.js +12 -0
- package/packages/happy2-server/dist/modules/permission/userRequireAnyPermission.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userRequirePermission.d.ts +8 -0
- package/packages/happy2-server/dist/modules/permission/userRequirePermission.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userRequirePermission.js +12 -0
- package/packages/happy2-server/dist/modules/permission/userRequirePermission.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userRoleAssign.d.ts +12 -0
- package/packages/happy2-server/dist/modules/permission/userRoleAssign.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userRoleAssign.js +46 -0
- package/packages/happy2-server/dist/modules/permission/userRoleAssign.js.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userRoleUnassign.d.ts +12 -0
- package/packages/happy2-server/dist/modules/permission/userRoleUnassign.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/permission/userRoleUnassign.js +53 -0
- package/packages/happy2-server/dist/modules/permission/userRoleUnassign.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/archive.d.ts +7 -0
- package/packages/happy2-server/dist/modules/plugin/archive.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/archive.js +222 -0
- package/packages/happy2-server/dist/modules/plugin/archive.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/catalog.d.ts +5 -1
- package/packages/happy2-server/dist/modules/plugin/catalog.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/catalog.js +35 -16
- package/packages/happy2-server/dist/modules/plugin/catalog.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/catalog.test.js +6 -2
- package/packages/happy2-server/dist/modules/plugin/catalog.test.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/httpBridge.d.ts +1 -0
- package/packages/happy2-server/dist/modules/plugin/httpBridge.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/httpBridge.js +7 -0
- package/packages/happy2-server/dist/modules/plugin/httpBridge.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/apiPermissions.d.ts +5 -0
- package/packages/happy2-server/dist/modules/plugin/impl/apiPermissions.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/impl/apiPermissions.js +106 -0
- package/packages/happy2-server/dist/modules/plugin/impl/apiPermissions.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.js +12 -2
- package/packages/happy2-server/dist/modules/plugin/impl/asInstallation.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/asManagementRequest.d.ts +3 -0
- package/packages/happy2-server/dist/modules/plugin/impl/asManagementRequest.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/impl/asManagementRequest.js +68 -0
- package/packages/happy2-server/dist/modules/plugin/impl/asManagementRequest.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.js +12 -3
- package/packages/happy2-server/dist/modules/plugin/impl/asPlugin.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.d.ts +19 -0
- package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.js +1 -0
- package/packages/happy2-server/dist/modules/plugin/impl/installationSelection.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.js +4 -2
- package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.test.js +14 -0
- package/packages/happy2-server/dist/modules/plugin/impl/installedManifest.test.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/impl/managementRequestSelection.d.ts +345 -0
- package/packages/happy2-server/dist/modules/plugin/impl/managementRequestSelection.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/impl/managementRequestSelection.js +22 -0
- package/packages/happy2-server/dist/modules/plugin/impl/managementRequestSelection.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.d.ts +11 -0
- package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.js +2 -0
- package/packages/happy2-server/dist/modules/plugin/impl/pluginSkillSource.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/packageLinkDownloader.d.ts +16 -0
- package/packages/happy2-server/dist/modules/plugin/packageLinkDownloader.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/packageLinkDownloader.js +67 -0
- package/packages/happy2-server/dist/modules/plugin/packageLinkDownloader.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/packageStore.d.ts +27 -1
- package/packages/happy2-server/dist/modules/plugin/packageStore.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/packageStore.js +234 -15
- package/packages/happy2-server/dist/modules/plugin/packageStore.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/packageStore.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/plugin/packageStore.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/packageStore.test.js +50 -0
- package/packages/happy2-server/dist/modules/plugin/packageStore.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginAgentCallContextGet.d.ts +5 -0
- package/packages/happy2-server/dist/modules/plugin/pluginAgentCallContextGet.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginAgentCallContextGet.js +26 -0
- package/packages/happy2-server/dist/modules/plugin/pluginAgentCallContextGet.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.d.ts +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.js +3 -3
- package/packages/happy2-server/dist/modules/plugin/pluginAuthorizeManagement.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.js +7 -3
- package/packages/happy2-server/dist/modules/plugin/pluginCatalogList.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginDeveloperServer.test.d.ts +2 -0
- package/packages/happy2-server/dist/modules/plugin/pluginDeveloperServer.test.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginDeveloperServer.test.js +44 -0
- package/packages/happy2-server/dist/modules/plugin/pluginDeveloperServer.test.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.d.ts +3 -1
- package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.js +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginFindBySource.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginGetImage.d.ts +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginGetImage.js +3 -3
- package/packages/happy2-server/dist/modules/plugin/pluginGetImage.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginGetSource.d.ts +13 -0
- package/packages/happy2-server/dist/modules/plugin/pluginGetSource.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginGetSource.js +37 -0
- package/packages/happy2-server/dist/modules/plugin/pluginGetSource.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstall.d.ts +4 -2
- package/packages/happy2-server/dist/modules/plugin/pluginInstall.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginInstall.js +36 -5
- package/packages/happy2-server/dist/modules/plugin/pluginInstall.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetContainerName.d.ts +7 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetContainerName.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetContainerName.js +18 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetContainerName.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRequestUninstallContext.d.ts +13 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRequestUninstallContext.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRequestUninstallContext.js +35 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRequestUninstallContext.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.js +3 -1
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetRuntimeConfiguration.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetUninstallContext.d.ts +6 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetUninstallContext.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetUninstallContext.js +17 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationGetUninstallContext.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.d.ts +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.js +3 -3
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationList.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationPermissionsUpdate.d.ts +18 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationPermissionsUpdate.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationPermissionsUpdate.js +92 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationPermissionsUpdate.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationUninstall.d.ts +16 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationUninstall.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationUninstall.js +71 -0
- package/packages/happy2-server/dist/modules/plugin/pluginInstallationUninstall.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginList.d.ts +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginList.js +3 -3
- package/packages/happy2-server/dist/modules/plugin/pluginList.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginInstall.d.ts +21 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginInstall.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginInstall.js +71 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginInstall.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginUninstall.d.ts +12 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginUninstall.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginUninstall.js +56 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestBeginUninstall.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteInstall.d.ts +11 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteInstall.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteInstall.js +44 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteInstall.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteUninstall.d.ts +10 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteUninstall.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteUninstall.js +41 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCompleteUninstall.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateInstall.d.ts +26 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateInstall.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateInstall.js +78 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateInstall.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateUninstall.d.ts +25 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateUninstall.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateUninstall.js +76 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestCreateUninstall.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestDeny.d.ts +11 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestDeny.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestDeny.js +48 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestDeny.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestGetPackage.d.ts +12 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestGetPackage.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestGetPackage.js +42 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestGetPackage.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestList.d.ts +5 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestList.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestList.js +18 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestList.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestListTerminalIds.d.ts +4 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestListTerminalIds.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestListTerminalIds.js +11 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestListTerminalIds.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestRecoverProcessing.d.ts +5 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestRecoverProcessing.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestRecoverProcessing.js +75 -0
- package/packages/happy2-server/dist/modules/plugin/pluginManagementRequestRecoverProcessing.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillPackageListReady.d.ts +12 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillPackageListReady.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillPackageListReady.js +33 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillPackageListReady.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.d.ts +8 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.js +24 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillsListInstalled.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.d.ts +8 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.js +25 -0
- package/packages/happy2-server/dist/modules/plugin/pluginSkillsListReady.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginUninstall.d.ts +13 -0
- package/packages/happy2-server/dist/modules/plugin/pluginUninstall.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/pluginUninstall.js +63 -0
- package/packages/happy2-server/dist/modules/plugin/pluginUninstall.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/runtime.d.ts +1 -0
- package/packages/happy2-server/dist/modules/plugin/runtime.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/runtime.js +1 -0
- package/packages/happy2-server/dist/modules/plugin/runtime.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/service.d.ts +157 -5
- package/packages/happy2-server/dist/modules/plugin/service.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/service.js +789 -19
- package/packages/happy2-server/dist/modules/plugin/service.js.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/source.d.ts +35 -0
- package/packages/happy2-server/dist/modules/plugin/source.d.ts.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/source.js +189 -0
- package/packages/happy2-server/dist/modules/plugin/source.js.map +1 -0
- package/packages/happy2-server/dist/modules/plugin/types.d.ts +116 -11
- package/packages/happy2-server/dist/modules/plugin/types.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/plugin/types.js +9 -0
- package/packages/happy2-server/dist/modules/plugin/types.js.map +1 -1
- package/packages/happy2-server/dist/modules/realtime/events.d.ts +3 -0
- package/packages/happy2-server/dist/modules/realtime/events.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/realtime/events.js +37 -5
- package/packages/happy2-server/dist/modules/realtime/events.js.map +1 -1
- package/packages/happy2-server/dist/modules/realtime/local.test.js +2 -0
- package/packages/happy2-server/dist/modules/realtime/local.test.js.map +1 -1
- package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.js +4 -2
- package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.js.map +1 -1
- package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.test.js +4 -1
- package/packages/happy2-server/dist/modules/sandbox/localOciSandboxProvider.test.js.map +1 -1
- package/packages/happy2-server/dist/modules/sandbox/types.d.ts +1 -0
- package/packages/happy2-server/dist/modules/sandbox/types.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/schema.d.ts +8024 -5446
- package/packages/happy2-server/dist/modules/schema.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/schema.js +140 -0
- package/packages/happy2-server/dist/modules/schema.js.map +1 -1
- package/packages/happy2-server/dist/modules/sync/syncGetDifference.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/sync/syncGetDifference.js +2 -0
- package/packages/happy2-server/dist/modules/sync/syncGetDifference.js.map +1 -1
- package/packages/happy2-server/dist/modules/user/userAdministrationList.js +2 -2
- package/packages/happy2-server/dist/modules/user/userAdministrationList.js.map +1 -1
- package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.js +49 -6
- package/packages/happy2-server/dist/modules/user/userAdministrationUpdate.js.map +1 -1
- package/packages/happy2-server/dist/modules/user/userCreateProfile.d.ts.map +1 -1
- package/packages/happy2-server/dist/modules/user/userCreateProfile.js +17 -2
- package/packages/happy2-server/dist/modules/user/userCreateProfile.js.map +1 -1
- package/packages/happy2-server/dist/routes/agents.d.ts.map +1 -1
- package/packages/happy2-server/dist/routes/agents.js +4 -2
- package/packages/happy2-server/dist/routes/agents.js.map +1 -1
- package/packages/happy2-server/dist/routes/auth.d.ts.map +1 -1
- package/packages/happy2-server/dist/routes/auth.js +12 -0
- package/packages/happy2-server/dist/routes/auth.js.map +1 -1
- package/packages/happy2-server/dist/routes/collaboration.d.ts.map +1 -1
- package/packages/happy2-server/dist/routes/collaboration.js +7 -0
- package/packages/happy2-server/dist/routes/collaboration.js.map +1 -1
- package/packages/happy2-server/dist/routes/files.d.ts.map +1 -1
- package/packages/happy2-server/dist/routes/files.js +2 -0
- package/packages/happy2-server/dist/routes/files.js.map +1 -1
- package/packages/happy2-server/dist/routes/permissions.d.ts +6 -0
- package/packages/happy2-server/dist/routes/permissions.d.ts.map +1 -0
- package/packages/happy2-server/dist/routes/permissions.js +207 -0
- package/packages/happy2-server/dist/routes/permissions.js.map +1 -0
- package/packages/happy2-server/dist/routes/pluginHost.d.ts +2 -1
- package/packages/happy2-server/dist/routes/pluginHost.d.ts.map +1 -1
- package/packages/happy2-server/dist/routes/pluginHost.js +356 -5
- package/packages/happy2-server/dist/routes/pluginHost.js.map +1 -1
- package/packages/happy2-server/dist/routes/plugins.d.ts.map +1 -1
- package/packages/happy2-server/dist/routes/plugins.js +375 -7
- package/packages/happy2-server/dist/routes/plugins.js.map +1 -1
- package/packages/happy2-server/dist/server.d.ts +4 -0
- package/packages/happy2-server/dist/server.d.ts.map +1 -1
- package/packages/happy2-server/dist/server.js +12 -7
- package/packages/happy2-server/dist/server.js.map +1 -1
- package/packages/happy2-server/dist/web/assets/index-Dn5SZu3y.js +39 -0
- package/packages/happy2-server/dist/web/assets/index-Dys3sWv8.css +2 -0
- package/packages/happy2-server/dist/web/index.html +2 -2
- package/packages/happy2-server/drizzle/0023_roles_and_permissions.sql +82 -0
- package/packages/happy2-server/drizzle/0024_session_bound_dev_tokens.sql +11 -0
- package/packages/happy2-server/drizzle/0025_plugin_skills.sql +8 -0
- package/packages/happy2-server/drizzle/0026_agent_turn_traces.sql +35 -0
- package/packages/happy2-server/drizzle/0027_chat_agent_effort.sql +9 -0
- package/packages/happy2-server/drizzle/0028_plugin_api_permissions.sql +1 -0
- package/packages/happy2-server/drizzle/0029_plugin_management_requests.sql +35 -0
- package/packages/happy2-server/drizzle/meta/_journal.json +49 -0
- package/packages/happy2-server/happy2.example.toml +6 -0
- package/packages/happy2-server/plugins/README.md +7 -1
- package/packages/happy2-server/plugins/chat-management/container/Dockerfile +6 -0
- package/packages/happy2-server/plugins/chat-management/plugin.json +17 -0
- package/packages/happy2-server/plugins/chat-management/plugin.png +0 -0
- package/packages/happy2-server/plugins/chat-management/server.mjs +280 -0
- package/packages/happy2-server/plugins/plugin-developer/container/Dockerfile +6 -0
- package/packages/happy2-server/plugins/plugin-developer/plugin.json +17 -0
- package/packages/happy2-server/plugins/plugin-developer/plugin.png +0 -0
- package/packages/happy2-server/plugins/plugin-developer/server.mjs +155 -0
- package/packages/happy2-server/plugins/plugin-developer/skills/happy2-plugin-development/SKILL.md +59 -0
- package/packages/happy2-server/plugins/plugin-developer/skills/happy2-plugin-development/references/host-api.md +63 -0
- package/packages/happy2-server/plugins/plugin-developer/skills/happy2-plugin-development/references/installing.md +86 -0
- package/packages/happy2-server/plugins/plugin-developer/skills/happy2-plugin-development/references/package-format.md +137 -0
- package/packages/happy2-server/dist/web/assets/index-9SGCQLg7.js +0 -46
- package/packages/happy2-server/dist/web/assets/index-DWXBQDJB.css +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userPermissionGet.js","sourceRoot":"","sources":["../../../sources/modules/permission/userPermissionGet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,QAAyB,EACzB,KAA8C;IAM9C,MAAM,qBAAqB,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;IAC7E,MAAM,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrD,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACxD,QAAQ;aACH,MAAM,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,UAAU,EAAE,CAAC;aAClD,IAAI,CAAC,eAAe,CAAC;aACrB,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACpD,QAAQ;aACH,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC;aACpC,IAAI,CAAC,SAAS,CAAC;aACf,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;aACzC,OAAO,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;QACnD,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;KACjD,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,IAAI,GAAG,CACrB,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAwB,CAAC,CAC/D,CAAC;IACF,OAAO;QACH,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC;QAC7C,SAAS;KACZ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DrizzleExecutor } from "../drizzle.js";
|
|
2
|
+
import type { Permission, PermissionMutation } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Replaces an active user's complete userPermissions allow-list without altering grants inherited from assigned roles.
|
|
5
|
+
* The replacement and targeted invalidation share one transaction so `/v0/me` can be safely refetched as soon as clients receive the hint.
|
|
6
|
+
*/
|
|
7
|
+
export declare function userPermissionUpdate(executor: DrizzleExecutor, input: {
|
|
8
|
+
actorUserId: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
permissions: Permission[];
|
|
11
|
+
}): Promise<PermissionMutation>;
|
|
12
|
+
//# sourceMappingURL=userPermissionUpdate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userPermissionUpdate.d.ts","sourceRoot":"","sources":["../../../sources/modules/permission/userPermissionUpdate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,eAAe,CAAC;AAGtE,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGjE;;;GAGG;AACH,wBAAsB,oBAAoB,CACtC,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAA;CAAE,GAC1E,OAAO,CAAC,kBAAkB,CAAC,CAiC7B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { eq } from "drizzle-orm";
|
|
2
|
+
import { chatAppendAudit } from "../chat/chatAppendAudit.js";
|
|
3
|
+
import { userRequireActiveHuman } from "../chat/userRequireActiveHuman.js";
|
|
4
|
+
import { withTransaction } from "../drizzle.js";
|
|
5
|
+
import { userPermissions } from "../schema.js";
|
|
6
|
+
import { permissionMutationRecord } from "./impl/permissionMutationRecord.js";
|
|
7
|
+
import { userRequirePermission } from "./userRequirePermission.js";
|
|
8
|
+
/**
|
|
9
|
+
* Replaces an active user's complete userPermissions allow-list without altering grants inherited from assigned roles.
|
|
10
|
+
* The replacement and targeted invalidation share one transaction so `/v0/me` can be safely refetched as soon as clients receive the hint.
|
|
11
|
+
*/
|
|
12
|
+
export async function userPermissionUpdate(executor, input) {
|
|
13
|
+
return withTransaction(executor, async (tx) => {
|
|
14
|
+
await userRequirePermission(tx, input.actorUserId, "manageAdminRoles");
|
|
15
|
+
await userRequireActiveHuman(tx, input.userId);
|
|
16
|
+
const before = await tx
|
|
17
|
+
.select({ permission: userPermissions.permission })
|
|
18
|
+
.from(userPermissions)
|
|
19
|
+
.where(eq(userPermissions.userId, input.userId));
|
|
20
|
+
await tx.delete(userPermissions).where(eq(userPermissions.userId, input.userId));
|
|
21
|
+
if (input.permissions.length)
|
|
22
|
+
await tx.insert(userPermissions).values(input.permissions.map((permission) => ({
|
|
23
|
+
userId: input.userId,
|
|
24
|
+
permission,
|
|
25
|
+
grantedByUserId: input.actorUserId,
|
|
26
|
+
})));
|
|
27
|
+
await chatAppendAudit(tx, {
|
|
28
|
+
actorUserId: input.actorUserId,
|
|
29
|
+
action: "user.permissions_updated",
|
|
30
|
+
targetType: "user",
|
|
31
|
+
targetId: input.userId,
|
|
32
|
+
before: { permissions: before.map(({ permission }) => permission) },
|
|
33
|
+
after: { permissions: input.permissions },
|
|
34
|
+
});
|
|
35
|
+
return permissionMutationRecord(tx, {
|
|
36
|
+
actorUserId: input.actorUserId,
|
|
37
|
+
affectedUserIds: [input.userId],
|
|
38
|
+
broadcast: false,
|
|
39
|
+
entityId: input.userId,
|
|
40
|
+
kind: "permissions.changed",
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=userPermissionUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userPermissionUpdate.js","sourceRoot":"","sources":["../../../sources/modules/permission/userPermissionUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAwB,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACtC,QAAyB,EACzB,KAAyE;IAEzE,OAAO,eAAe,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAC1C,MAAM,qBAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QACvE,MA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QAAQ,EAAE,KAAK,CAAC,MAAM;YACtB,IAAI,EAAE,qBAAqB;SAC9B,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DrizzleExecutor } from "../drizzle.js";
|
|
2
|
+
import type { Permission } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Requires at least one permission from an explicit set for shared read surfaces used by adjacent management capabilities.
|
|
5
|
+
* The owner remains allow-all, while ordinary users must receive one listed grant directly or through a role.
|
|
6
|
+
*/
|
|
7
|
+
export declare function userRequireAnyPermission(executor: DrizzleExecutor, userId: string, required: readonly Permission[]): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=userRequireAnyPermission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userRequireAnyPermission.d.ts","sourceRoot":"","sources":["../../../sources/modules/permission/userRequireAnyPermission.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,wBAAwB,CAC1C,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,UAAU,EAAE,GAChC,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CollaborationError } from "../chat/types.js";
|
|
2
|
+
import { permissionEffectiveDb } from "./impl/permissionEffectiveDb.js";
|
|
3
|
+
/**
|
|
4
|
+
* Requires at least one permission from an explicit set for shared read surfaces used by adjacent management capabilities.
|
|
5
|
+
* The owner remains allow-all, while ordinary users must receive one listed grant directly or through a role.
|
|
6
|
+
*/
|
|
7
|
+
export async function userRequireAnyPermission(executor, userId, required) {
|
|
8
|
+
const effective = await permissionEffectiveDb(executor, userId);
|
|
9
|
+
if (!effective || !required.some((permission) => effective.allowed.includes(permission)))
|
|
10
|
+
throw new CollaborationError("forbidden", `${required.join(" or ")} permission is required`);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=userRequireAnyPermission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userRequireAnyPermission.js","sourceRoot":"","sources":["../../../sources/modules/permission/userRequireAnyPermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAGxE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC1C,QAAyB,EACzB,MAAc,EACd,QAA+B;IAE/B,MAAM,SAAS,GAAG,MAAM,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChE,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACpF,MAAM,IAAI,kBAAkB,CACxB,WAAW,EACX,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,yBAAyB,CACpD,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DrizzleExecutor } from "../drizzle.js";
|
|
2
|
+
import type { Permission } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Requires one effective permission from an active human user, treating the durable server owner as an explicit allow-all principal.
|
|
5
|
+
* Centralizing this check prevents feature routes from confusing legacy administrator labels with narrowly delegated authority.
|
|
6
|
+
*/
|
|
7
|
+
export declare function userRequirePermission(executor: DrizzleExecutor, userId: string, permission: Permission): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=userRequirePermission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userRequirePermission.d.ts","sourceRoot":"","sources":["../../../sources/modules/permission/userRequirePermission.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,qBAAqB,CACvC,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,GACvB,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CollaborationError } from "../chat/types.js";
|
|
2
|
+
import { permissionEffectiveDb } from "./impl/permissionEffectiveDb.js";
|
|
3
|
+
/**
|
|
4
|
+
* Requires one effective permission from an active human user, treating the durable server owner as an explicit allow-all principal.
|
|
5
|
+
* Centralizing this check prevents feature routes from confusing legacy administrator labels with narrowly delegated authority.
|
|
6
|
+
*/
|
|
7
|
+
export async function userRequirePermission(executor, userId, permission) {
|
|
8
|
+
const effective = await permissionEffectiveDb(executor, userId);
|
|
9
|
+
if (!effective?.allowed.includes(permission))
|
|
10
|
+
throw new CollaborationError("forbidden", `${permission} permission is required`);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=userRequirePermission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userRequirePermission.js","sourceRoot":"","sources":["../../../sources/modules/permission/userRequirePermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAGxE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACvC,QAAyB,EACzB,MAAc,EACd,UAAsB;IAEtB,MAAM,SAAS,GAAG,MAAM,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;QACxC,MAAM,IAAI,kBAAkB,CAAC,WAAW,EAAE,GAAG,UAAU,yBAAyB,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DrizzleExecutor } from "../drizzle.js";
|
|
2
|
+
import type { PermissionMutation } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Inserts one userRoles assignment for an active human user, synchronizing users when the durable admin marker is assigned.
|
|
5
|
+
* The grant, audit record, and targeted permission invalidation commit atomically so authorization never changes silently.
|
|
6
|
+
*/
|
|
7
|
+
export declare function userRoleAssign(executor: DrizzleExecutor, input: {
|
|
8
|
+
actorUserId: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
roleId: string;
|
|
11
|
+
}): Promise<PermissionMutation>;
|
|
12
|
+
//# sourceMappingURL=userRoleAssign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userRoleAssign.d.ts","sourceRoot":"","sources":["../../../sources/modules/permission/userRoleAssign.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,eAAe,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD;;;GAGG;AACH,wBAAsB,cAAc,CAChC,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC/D,OAAO,CAAC,kBAAkB,CAAC,CA+B7B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { eq } from "drizzle-orm";
|
|
2
|
+
import { chatAppendAudit } from "../chat/chatAppendAudit.js";
|
|
3
|
+
import { CollaborationError } from "../chat/types.js";
|
|
4
|
+
import { userRequireActiveHuman } from "../chat/userRequireActiveHuman.js";
|
|
5
|
+
import { withTransaction } from "../drizzle.js";
|
|
6
|
+
import { roles, userRoles, users } from "../schema.js";
|
|
7
|
+
import { permissionMutationRecord } from "./impl/permissionMutationRecord.js";
|
|
8
|
+
import { userRequirePermission } from "./userRequirePermission.js";
|
|
9
|
+
/**
|
|
10
|
+
* Inserts one userRoles assignment for an active human user, synchronizing users when the durable admin marker is assigned.
|
|
11
|
+
* The grant, audit record, and targeted permission invalidation commit atomically so authorization never changes silently.
|
|
12
|
+
*/
|
|
13
|
+
export async function userRoleAssign(executor, input) {
|
|
14
|
+
return withTransaction(executor, async (tx) => {
|
|
15
|
+
await userRequirePermission(tx, input.actorUserId, "manageAdminRoles");
|
|
16
|
+
await userRequireActiveHuman(tx, input.userId);
|
|
17
|
+
const [role] = await tx.select().from(roles).where(eq(roles.id, input.roleId)).limit(1);
|
|
18
|
+
if (!role)
|
|
19
|
+
throw new CollaborationError("not_found", "Role was not found");
|
|
20
|
+
await tx
|
|
21
|
+
.insert(userRoles)
|
|
22
|
+
.values({
|
|
23
|
+
userId: input.userId,
|
|
24
|
+
roleId: input.roleId,
|
|
25
|
+
assignedByUserId: input.actorUserId,
|
|
26
|
+
})
|
|
27
|
+
.onConflictDoNothing();
|
|
28
|
+
if (role.builtinKind === "admin")
|
|
29
|
+
await tx.update(users).set({ role: "admin" }).where(eq(users.id, input.userId));
|
|
30
|
+
await chatAppendAudit(tx, {
|
|
31
|
+
actorUserId: input.actorUserId,
|
|
32
|
+
action: "user.role_assigned",
|
|
33
|
+
targetType: "user",
|
|
34
|
+
targetId: input.userId,
|
|
35
|
+
after: { roleId: input.roleId },
|
|
36
|
+
});
|
|
37
|
+
return permissionMutationRecord(tx, {
|
|
38
|
+
actorUserId: input.actorUserId,
|
|
39
|
+
affectedUserIds: [input.userId],
|
|
40
|
+
broadcast: false,
|
|
41
|
+
entityId: input.userId,
|
|
42
|
+
kind: "permissions.changed",
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=userRoleAssign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AAE,KAAK,CAAC,MAAM;YACpB,gBAAgB,EAAE,KAAK,CAAC,WAAW;SACtC,CAAC;aACD,mBAAmB,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO;YAC5B,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QACpF,MAAM,eAAe,CAAC,EAAE,EAAE;YACtB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,oBAAoB;YAC5B,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,KAAK,CAAC,MAAM;YACtB,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;SAClC,CAAC,CAAC;QACH,OAAO,wBAAwB,CAAC,EAAE,EAAE;YAChC,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,eAAe,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;YAC/B,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,KAAK,CAAC,MAAM;YACtB,IAAI,EAAE,qBAAqB;SAC9B,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type DrizzleExecutor } from "../drizzle.js";
|
|
2
|
+
import type { PermissionMutation } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Deletes one userRoles assignment while preserving universal member membership and the owner's built-in administrator membership.
|
|
5
|
+
* Removing the admin marker also updates the coarse user projection before emitting the targeted permission invalidation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function userRoleUnassign(executor: DrizzleExecutor, input: {
|
|
8
|
+
actorUserId: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
roleId: string;
|
|
11
|
+
}): Promise<PermissionMutation>;
|
|
12
|
+
//# sourceMappingURL=userRoleUnassign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userRoleUnassign.d.ts","sourceRoot":"","sources":["../../../sources/modules/permission/userRoleUnassign.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,eAAe,CAAC;AAGtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD;;;GAGG;AACH,wBAAsB,gBAAgB,CAClC,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC/D,OAAO,CAAC,kBAAkB,CAAC,CAyC7B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { and, eq } from "drizzle-orm";
|
|
2
|
+
import { chatAppendAudit } from "../chat/chatAppendAudit.js";
|
|
3
|
+
import { CollaborationError } from "../chat/types.js";
|
|
4
|
+
import { userRequireActiveHuman } from "../chat/userRequireActiveHuman.js";
|
|
5
|
+
import { withTransaction } from "../drizzle.js";
|
|
6
|
+
import { roles, serverSetupState, userRoles, users } from "../schema.js";
|
|
7
|
+
import { permissionMutationRecord } from "./impl/permissionMutationRecord.js";
|
|
8
|
+
import { userRequirePermission } from "./userRequirePermission.js";
|
|
9
|
+
/**
|
|
10
|
+
* Deletes one userRoles assignment while preserving universal member membership and the owner's built-in administrator membership.
|
|
11
|
+
* Removing the admin marker also updates the coarse user projection before emitting the targeted permission invalidation.
|
|
12
|
+
*/
|
|
13
|
+
export async function userRoleUnassign(executor, input) {
|
|
14
|
+
return withTransaction(executor, async (tx) => {
|
|
15
|
+
await userRequirePermission(tx, input.actorUserId, "manageAdminRoles");
|
|
16
|
+
await userRequireActiveHuman(tx, input.userId);
|
|
17
|
+
const [role] = await tx.select().from(roles).where(eq(roles.id, input.roleId)).limit(1);
|
|
18
|
+
if (!role)
|
|
19
|
+
throw new CollaborationError("not_found", "Role was not found");
|
|
20
|
+
if (role.builtinKind === "member")
|
|
21
|
+
throw new CollaborationError("invalid", "The built-in member role is required");
|
|
22
|
+
if (role.builtinKind === "admin") {
|
|
23
|
+
if (input.actorUserId === input.userId)
|
|
24
|
+
throw new CollaborationError("invalid", "An administrator cannot demote themselves");
|
|
25
|
+
const [setup] = await tx
|
|
26
|
+
.select({ ownerUserId: serverSetupState.bootstrapAdminUserId })
|
|
27
|
+
.from(serverSetupState)
|
|
28
|
+
.where(eq(serverSetupState.id, 1));
|
|
29
|
+
if (setup?.ownerUserId === input.userId)
|
|
30
|
+
throw new CollaborationError("invalid", "The owner must remain an administrator");
|
|
31
|
+
}
|
|
32
|
+
await tx
|
|
33
|
+
.delete(userRoles)
|
|
34
|
+
.where(and(eq(userRoles.userId, input.userId), eq(userRoles.roleId, input.roleId)));
|
|
35
|
+
if (role.builtinKind === "admin")
|
|
36
|
+
await tx.update(users).set({ role: "member" }).where(eq(users.id, input.userId));
|
|
37
|
+
await chatAppendAudit(tx, {
|
|
38
|
+
actorUserId: input.actorUserId,
|
|
39
|
+
action: "user.role_unassigned",
|
|
40
|
+
targetType: "user",
|
|
41
|
+
targetId: input.userId,
|
|
42
|
+
before: { roleId: input.roleId },
|
|
43
|
+
});
|
|
44
|
+
return permissionMutationRecord(tx, {
|
|
45
|
+
actorUserId: input.actorUserId,
|
|
46
|
+
affectedUserIds: [input.userId],
|
|
47
|
+
broadcast: false,
|
|
48
|
+
entityId: input.userId,
|
|
49
|
+
kind: "permissions.changed",
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=userRoleUnassign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userRoleUnassign.js","sourceRoot":"","sources":["../../../sources/modules/permission/userRoleUnassign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM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AAE,CAAC,KAAK,CAAC,MAAM,CAAC;YAC/B,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,KAAK,CAAC,MAAM;YACtB,IAAI,EAAE,qBAAqB;SAC9B,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface PluginArchiveCandidate {
|
|
2
|
+
directory: string;
|
|
3
|
+
packagePath: string;
|
|
4
|
+
}
|
|
5
|
+
/** Extracts only eligible plugin package roots from a bounded ZIP, rejecting links, bombs, traversal, and ambiguous generic archives. */
|
|
6
|
+
export declare function pluginArchiveExtract(archive: Buffer, destination: string, kind: "github" | "zip"): Promise<PluginArchiveCandidate[]>;
|
|
7
|
+
//# sourceMappingURL=archive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/archive.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,sBAAsB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,yIAAyI;AACzI,wBAAsB,oBAAoB,CACtC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,QAAQ,GAAG,KAAK,GACvB,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAmEnC"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { inflateRawSync } from "node:zlib";
|
|
2
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, posix, resolve, sep } from "node:path";
|
|
4
|
+
const CENTRAL_SIGNATURE = 0x02014b50;
|
|
5
|
+
const END_SIGNATURE = 0x06054b50;
|
|
6
|
+
const LOCAL_SIGNATURE = 0x04034b50;
|
|
7
|
+
const MAX_ARCHIVE_BYTES = 50 * 1024 * 1024;
|
|
8
|
+
const MAX_ENTRIES = 10_000;
|
|
9
|
+
const MAX_PACKAGE_FILES = 1_000;
|
|
10
|
+
const MAX_PACKAGE_BYTES = 20 * 1024 * 1024;
|
|
11
|
+
const MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
12
|
+
/** Extracts only eligible plugin package roots from a bounded ZIP, rejecting links, bombs, traversal, and ambiguous generic archives. */
|
|
13
|
+
export async function pluginArchiveExtract(archive, destination, kind) {
|
|
14
|
+
if (archive.byteLength === 0 || archive.byteLength > MAX_ARCHIVE_BYTES)
|
|
15
|
+
throw new Error("Plugin ZIP must be between 1 byte and 50 MiB");
|
|
16
|
+
const entries = zipEntries(archive);
|
|
17
|
+
const files = entries.filter((entry) => !entry.name.endsWith("/"));
|
|
18
|
+
const wrapper = commonWrapper(entries.map(({ name }) => name));
|
|
19
|
+
const manifests = files
|
|
20
|
+
.map((entry) => ({ entry, path: stripWrapper(entry.name, wrapper) }))
|
|
21
|
+
.filter(({ path }) => path === "plugin.json" || path.endsWith("/plugin.json"));
|
|
22
|
+
let roots;
|
|
23
|
+
if (kind === "github") {
|
|
24
|
+
const root = manifests.find(({ path }) => path === "plugin.json");
|
|
25
|
+
const nested = manifests.filter(({ path }) => /^plugins\/[^/]+\/plugin\.json$/.test(path));
|
|
26
|
+
const selected = root ? [root] : nested;
|
|
27
|
+
if (selected.length === 0)
|
|
28
|
+
throw new Error("GitHub repository must contain plugin.json at its root or in plugins/<name>");
|
|
29
|
+
roots = selected.map(({ entry, path }) => ({
|
|
30
|
+
packagePath: posix.dirname(path) === "." ? "" : posix.dirname(path),
|
|
31
|
+
rawPrefix: posix.dirname(entry.name) === "." ? "" : `${posix.dirname(entry.name)}/`,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
if (manifests.length !== 1)
|
|
36
|
+
throw new Error("A plugin ZIP must contain exactly one plugin.json");
|
|
37
|
+
const [{ entry, path }] = manifests;
|
|
38
|
+
roots = [
|
|
39
|
+
{
|
|
40
|
+
packagePath: posix.dirname(path) === "." ? "" : posix.dirname(path),
|
|
41
|
+
rawPrefix: posix.dirname(entry.name) === "." ? "" : `${posix.dirname(entry.name)}/`,
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
await mkdir(destination, { recursive: true, mode: 0o700 });
|
|
46
|
+
const results = [];
|
|
47
|
+
for (const [index, root] of roots.entries()) {
|
|
48
|
+
const candidateDirectory = resolve(destination, `candidate-${index}`);
|
|
49
|
+
await mkdir(candidateDirectory, { recursive: true, mode: 0o700 });
|
|
50
|
+
const selected = files.filter(({ name }) => root.rawPrefix ? name.startsWith(root.rawPrefix) : true);
|
|
51
|
+
if (selected.length > MAX_PACKAGE_FILES)
|
|
52
|
+
throw new Error("Plugin package has too many files");
|
|
53
|
+
let totalBytes = 0;
|
|
54
|
+
const names = new Set();
|
|
55
|
+
for (const entry of selected) {
|
|
56
|
+
const relativeName = root.rawPrefix
|
|
57
|
+
? entry.name.slice(root.rawPrefix.length)
|
|
58
|
+
: entry.name;
|
|
59
|
+
const safeName = safeRelativePath(relativeName);
|
|
60
|
+
if (!safeName || names.has(safeName))
|
|
61
|
+
throw new Error("Plugin ZIP contains duplicate or invalid package paths");
|
|
62
|
+
names.add(safeName);
|
|
63
|
+
if (entry.uncompressedSize > MAX_FILE_BYTES)
|
|
64
|
+
throw new Error(`Plugin package file is too large: ${safeName}`);
|
|
65
|
+
totalBytes += entry.uncompressedSize;
|
|
66
|
+
if (totalBytes > MAX_PACKAGE_BYTES)
|
|
67
|
+
throw new Error("Plugin package is too large");
|
|
68
|
+
const output = resolve(candidateDirectory, safeName.split("/").join(sep));
|
|
69
|
+
if (!output.startsWith(`${candidateDirectory}${sep}`))
|
|
70
|
+
throw new Error("Plugin ZIP path escapes its package directory");
|
|
71
|
+
await mkdir(dirname(output), { recursive: true, mode: 0o700 });
|
|
72
|
+
await writeFile(output, zipEntryBody(archive, entry), { mode: 0o600 });
|
|
73
|
+
}
|
|
74
|
+
results.push({ directory: candidateDirectory, packagePath: root.packagePath });
|
|
75
|
+
}
|
|
76
|
+
return results;
|
|
77
|
+
}
|
|
78
|
+
function zipEntries(archive) {
|
|
79
|
+
const endOffset = findEnd(archive);
|
|
80
|
+
const entryCount = archive.readUInt16LE(endOffset + 10);
|
|
81
|
+
const centralSize = archive.readUInt32LE(endOffset + 12);
|
|
82
|
+
const centralOffset = archive.readUInt32LE(endOffset + 16);
|
|
83
|
+
if (entryCount === 0xffff || centralSize === 0xffffffff || centralOffset === 0xffffffff)
|
|
84
|
+
throw new Error("ZIP64 plugin archives are not supported");
|
|
85
|
+
if (entryCount === 0 || entryCount > MAX_ENTRIES)
|
|
86
|
+
throw new Error("Plugin ZIP has an invalid number of entries");
|
|
87
|
+
if (centralOffset + centralSize > endOffset)
|
|
88
|
+
throw new Error("Plugin ZIP central directory is invalid");
|
|
89
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
90
|
+
const result = [];
|
|
91
|
+
let offset = centralOffset;
|
|
92
|
+
for (let index = 0; index < entryCount; index += 1) {
|
|
93
|
+
if (offset + 46 > archive.byteLength || archive.readUInt32LE(offset) !== CENTRAL_SIGNATURE)
|
|
94
|
+
throw new Error("Plugin ZIP central directory is malformed");
|
|
95
|
+
const flags = archive.readUInt16LE(offset + 8);
|
|
96
|
+
const method = archive.readUInt16LE(offset + 10);
|
|
97
|
+
const nameLength = archive.readUInt16LE(offset + 28);
|
|
98
|
+
const extraLength = archive.readUInt16LE(offset + 30);
|
|
99
|
+
const commentLength = archive.readUInt16LE(offset + 32);
|
|
100
|
+
const next = offset + 46 + nameLength + extraLength + commentLength;
|
|
101
|
+
if (next > archive.byteLength)
|
|
102
|
+
throw new Error("Plugin ZIP entry is truncated");
|
|
103
|
+
if ((flags & 0x1) !== 0)
|
|
104
|
+
throw new Error("Encrypted plugin ZIP entries are not supported");
|
|
105
|
+
if (method !== 0 && method !== 8)
|
|
106
|
+
throw new Error("Plugin ZIP uses an unsupported compression method");
|
|
107
|
+
let name;
|
|
108
|
+
try {
|
|
109
|
+
name = decoder.decode(archive.subarray(offset + 46, offset + 46 + nameLength));
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
throw new Error("Plugin ZIP entry names must use valid UTF-8");
|
|
113
|
+
}
|
|
114
|
+
name = safeArchivePath(name);
|
|
115
|
+
const externalAttributes = archive.readUInt32LE(offset + 38);
|
|
116
|
+
const unixMode = externalAttributes >>> 16;
|
|
117
|
+
if ((unixMode & 0o170000) === 0o120000)
|
|
118
|
+
throw new Error("Plugin ZIP packages may not contain symbolic links");
|
|
119
|
+
result.push({
|
|
120
|
+
compressedSize: archive.readUInt32LE(offset + 20),
|
|
121
|
+
crc32: archive.readUInt32LE(offset + 16),
|
|
122
|
+
externalAttributes,
|
|
123
|
+
flags,
|
|
124
|
+
localOffset: archive.readUInt32LE(offset + 42),
|
|
125
|
+
method,
|
|
126
|
+
name,
|
|
127
|
+
uncompressedSize: archive.readUInt32LE(offset + 24),
|
|
128
|
+
});
|
|
129
|
+
offset = next;
|
|
130
|
+
}
|
|
131
|
+
if (offset !== centralOffset + centralSize)
|
|
132
|
+
throw new Error("Plugin ZIP central directory size does not match its entries");
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
function zipEntryBody(archive, entry) {
|
|
136
|
+
const offset = entry.localOffset;
|
|
137
|
+
if (offset + 30 > archive.byteLength || archive.readUInt32LE(offset) !== LOCAL_SIGNATURE)
|
|
138
|
+
throw new Error("Plugin ZIP local entry is malformed");
|
|
139
|
+
const nameLength = archive.readUInt16LE(offset + 26);
|
|
140
|
+
const extraLength = archive.readUInt16LE(offset + 28);
|
|
141
|
+
let localName;
|
|
142
|
+
try {
|
|
143
|
+
localName = new TextDecoder("utf-8", { fatal: true }).decode(archive.subarray(offset + 30, offset + 30 + nameLength));
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
throw new Error("Plugin ZIP local entry names must use valid UTF-8");
|
|
147
|
+
}
|
|
148
|
+
if (safeArchivePath(localName) !== entry.name)
|
|
149
|
+
throw new Error("Plugin ZIP local and central entry names do not match");
|
|
150
|
+
const start = offset + 30 + nameLength + extraLength;
|
|
151
|
+
const end = start + entry.compressedSize;
|
|
152
|
+
if (end > archive.byteLength)
|
|
153
|
+
throw new Error("Plugin ZIP entry data is truncated");
|
|
154
|
+
const compressed = archive.subarray(start, end);
|
|
155
|
+
let body;
|
|
156
|
+
try {
|
|
157
|
+
body =
|
|
158
|
+
entry.method === 0
|
|
159
|
+
? Buffer.from(compressed)
|
|
160
|
+
: inflateRawSync(compressed, {
|
|
161
|
+
maxOutputLength: Math.max(1, entry.uncompressedSize + 1),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
throw new Error(`Plugin ZIP entry cannot be safely decompressed: ${entry.name}`, {
|
|
166
|
+
cause: error,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (body.byteLength !== entry.uncompressedSize)
|
|
170
|
+
throw new Error(`Plugin ZIP entry size is invalid: ${entry.name}`);
|
|
171
|
+
if (crc32(body) !== entry.crc32)
|
|
172
|
+
throw new Error(`Plugin ZIP entry checksum is invalid: ${entry.name}`);
|
|
173
|
+
return body;
|
|
174
|
+
}
|
|
175
|
+
function findEnd(archive) {
|
|
176
|
+
const minimum = Math.max(0, archive.byteLength - 65_557);
|
|
177
|
+
for (let offset = archive.byteLength - 22; offset >= minimum; offset -= 1)
|
|
178
|
+
if (archive.readUInt32LE(offset) === END_SIGNATURE) {
|
|
179
|
+
const commentLength = archive.readUInt16LE(offset + 20);
|
|
180
|
+
if (offset + 22 + commentLength === archive.byteLength)
|
|
181
|
+
return offset;
|
|
182
|
+
}
|
|
183
|
+
throw new Error("Plugin upload is not a valid ZIP archive");
|
|
184
|
+
}
|
|
185
|
+
function commonWrapper(names) {
|
|
186
|
+
const firstParts = names.map((name) => name.split("/", 1)[0]).filter(Boolean);
|
|
187
|
+
if (!firstParts.length || !firstParts.every((part) => part === firstParts[0]))
|
|
188
|
+
return "";
|
|
189
|
+
return names.some((name) => name === firstParts[0]) ? "" : `${firstParts[0]}/`;
|
|
190
|
+
}
|
|
191
|
+
function stripWrapper(name, wrapper) {
|
|
192
|
+
return wrapper && name.startsWith(wrapper) ? name.slice(wrapper.length) : name;
|
|
193
|
+
}
|
|
194
|
+
function safeArchivePath(value) {
|
|
195
|
+
if (!value || value.includes("\0") || value.includes("\\") || value.startsWith("/"))
|
|
196
|
+
throw new Error("Plugin ZIP contains an unsafe entry path");
|
|
197
|
+
const directory = value.endsWith("/");
|
|
198
|
+
const normalized = posix.normalize(value);
|
|
199
|
+
if (normalized === ".." || normalized.startsWith("../") || normalized.startsWith("/"))
|
|
200
|
+
throw new Error("Plugin ZIP contains an unsafe entry path");
|
|
201
|
+
return directory && !normalized.endsWith("/") ? `${normalized}/` : normalized;
|
|
202
|
+
}
|
|
203
|
+
function safeRelativePath(value) {
|
|
204
|
+
if (!value || value.endsWith("/"))
|
|
205
|
+
return undefined;
|
|
206
|
+
const normalized = safeArchivePath(value);
|
|
207
|
+
return normalized === "." ? undefined : normalized;
|
|
208
|
+
}
|
|
209
|
+
let crcTable;
|
|
210
|
+
function crc32(value) {
|
|
211
|
+
crcTable ??= Uint32Array.from({ length: 256 }, (_, index) => {
|
|
212
|
+
let current = index;
|
|
213
|
+
for (let bit = 0; bit < 8; bit += 1)
|
|
214
|
+
current = (current & 1) !== 0 ? 0xedb88320 ^ (current >>> 1) : current >>> 1;
|
|
215
|
+
return current >>> 0;
|
|
216
|
+
});
|
|
217
|
+
let result = 0xffffffff;
|
|
218
|
+
for (const byte of value)
|
|
219
|
+
result = crcTable[(result ^ byte) & 0xff] ^ (result >>> 8);
|
|
220
|
+
return (result ^ 0xffffffff) >>> 0;
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=archive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../../sources/modules/plugin/archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc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AC;AAED,IAAI,QAAiC,CAAC;AAEtC,SAAS,KAAK,CAAC,KAAa;IACxB,QAAQ,KAAK,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QACxD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC;YAC/B,OAAO,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC;QACjF,OAAO,OAAO,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,GAAG,UAAU,CAAC;IACxB,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAE,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;IACtF,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginPackage } from "./types.js";
|
|
1
|
+
import type { PluginPackage, PluginSource } from "./types.js";
|
|
2
2
|
/** Immutable lookup over validated plugin packages supplied by the built-in catalog. */
|
|
3
3
|
export declare class PluginCatalog {
|
|
4
4
|
private readonly packages;
|
|
@@ -10,4 +10,8 @@ export declare class PluginCatalog {
|
|
|
10
10
|
export declare function pluginCatalogLoad(root: string): Promise<PluginCatalog>;
|
|
11
11
|
/** Loads one built-in package while rejecting unsafe paths, malformed manifests, invalid skills, and non-square icons. */
|
|
12
12
|
export declare function pluginPackageLoad(directory: string, sourceReference?: string): Promise<PluginPackage>;
|
|
13
|
+
/** Loads one downloaded package with the same validation as a built-in package without coupling its short name to an archive directory. */
|
|
14
|
+
export declare function pluginPackageLoadSource(directory: string, source: PluginSource, requireDirectoryName?: boolean): Promise<PluginPackage>;
|
|
15
|
+
/** Revalidates an installed package while excluding Happy's reserved writable data subtree from its immutable package digest. */
|
|
16
|
+
export declare function pluginPackageLoadInstalled(directory: string, source: PluginSource, expectedShortName: string): Promise<PluginPackage>;
|
|
13
17
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/catalog.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGR,aAAa,
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../sources/modules/plugin/catalog.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGR,aAAa,EACb,YAAY,EAKf,MAAM,YAAY,CAAC;AA8BpB,wFAAwF;AACxF,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAE9D,YAAY,QAAQ,EAAE,SAAS,aAAa,EAAE,EAQ7C;IAED,IAAI,IAAI,aAAa,EAAE,CAItB;IAED,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEhD;CACJ;AAED,qFAAqF;AACrF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAc5E;AAED,0HAA0H;AAC1H,wBAAsB,iBAAiB,CACnC,SAAS,EAAE,MAAM,EACjB,eAAe,SAAsB,GACtC,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED,2IAA2I;AAC3I,wBAAsB,uBAAuB,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,EACpB,oBAAoB,UAAQ,GAC7B,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED,iIAAiI;AACjI,wBAAsB,0BAA0B,CAC5C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,EACpB,iBAAiB,EAAE,MAAM,GAC1B,OAAO,CAAC,aAAa,CAAC,CAKxB"}
|